mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-03 16:10:21 +00:00
+5![github-actions[bot]](https://secure.gravatar.com/avatar/cb7b7994e594270ea25948a7bf186123?d=identicon&s=40)








ae22a74e62
#11720 Design at: https://github.com/openobserve/designs/blob/main/dashboards/ux-improvement-dialog/design.md --------- --------- Co-authored-by: ktx-vaidehi <134508096+ktx-vaidehi@users.noreply.github.com> Co-authored-by: Abhay Padamani <141122205+ktx-abhay@users.noreply.github.com> Co-authored-by: Sai Nikhil <nikhil@openobserve.ai> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: ktx-akshay <akshay.patil@kiara.tech> Co-authored-by: Bhargav <BJP232004@GMAIL.COM> Co-authored-by: ktx-mihir <mihir.patel@kiara.tech> Co-authored-by: ktx-riya <riya.kukadiya@kiara.tech> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Omkar Kesarkhane <127078473+omkarK06@users.noreply.github.com> Co-authored-by: omkark06 <omkar@zinclabs.io> Co-authored-by: ktx-vaidehi <vaidehi.akhani@kiara.tech> Co-authored-by: ktx-abhay <abhay.padamani@kiara.tech> Co-authored-by: Shrinath Rao <shnath@openobserve.ai>
230 lines
6.6 KiB
YAML
230 lines
6.6 KiB
YAML
name: Database Validation Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
merge_group:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
COLUMNS: 150
|
|
ZO_ROOT_USER_EMAIL: root@example.com
|
|
ZO_ROOT_USER_PASSWORD: Complexpass#123
|
|
ZO_BASE_URL: http://localhost:5080/
|
|
ZO_INTERNAL_GRPC_TOKEN: fake_token_for_testing
|
|
ZO_MEM_PERSIST_INTERVAL: 1
|
|
ZO_MAX_FILE_RETENTION_TIME: 1
|
|
ZO_FILE_PUSH_INTERVAL: 1
|
|
|
|
jobs:
|
|
check_changes:
|
|
name: check_changes
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
has_changes: ${{ steps.check.outputs.has_changes }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- id: check
|
|
run: |
|
|
CHANGED=$(git diff --name-only origin/${{ github.base_ref || 'main' }} ${{ github.sha }})
|
|
if [ -z "$CHANGED" ]; then
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
elif echo "$CHANGED" | grep -qvE '(\.md$|^docs/|^web/|^tests/ui-testing/|^tests/playwright-tests/)'; then
|
|
echo "has_changes=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has_changes=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
db_validation_tests:
|
|
name: db_validation_tests
|
|
needs: [check_changes]
|
|
if: needs.check_changes.outputs.has_changes == 'true'
|
|
runs-on: ubicloud-standard-8
|
|
permissions:
|
|
contents: read
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:17.5-alpine3.22
|
|
env:
|
|
POSTGRES_PASSWORD: password
|
|
ports:
|
|
- 5432:5432
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- name: Remove unused tools
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf "/usr/local/share/boost"
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
|
|
- name: Checkout git repo
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Rust Toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: nightly-2025-11-11
|
|
|
|
- name: Setup Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
shared-key: backend-debug-mimalloc
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
|
|
- name: Install Protoc
|
|
run: |
|
|
bash ./.github/protoc.sh
|
|
|
|
- name: Build OpenObserve debug binary
|
|
run: cargo build --features mimalloc
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11.6"
|
|
|
|
- name: Create db-testing directory structure
|
|
run: |
|
|
mkdir -p tests/db-testing/tests
|
|
if [ ! -f tests/db-testing/pyproject.toml ]; then
|
|
cat > tests/db-testing/pyproject.toml << 'EOF'
|
|
[project]
|
|
name = "db-testing"
|
|
version = "0.1.0"
|
|
description = "Database validation tests for OpenObserve"
|
|
dependencies = [
|
|
"pytest>=7.4.0",
|
|
"requests>=2.31.0",
|
|
"psycopg2-binary>=2.9.9",
|
|
"python-dotenv>=1.0.0",
|
|
]
|
|
requires-python = ">= 3.11"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["tests"]
|
|
|
|
[tool.rye]
|
|
managed = true
|
|
dev-dependencies = []
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
python_classes = ["Test*"]
|
|
python_functions = ["test_*"]
|
|
EOF
|
|
fi
|
|
|
|
- name: Setup rye
|
|
uses: eifinger/setup-rye@v4
|
|
with:
|
|
enable-cache: false
|
|
working-directory: "tests/db-testing/"
|
|
version: "0.27.0"
|
|
|
|
- name: Pin cpython
|
|
run: rye pin cpython@3.11.6
|
|
working-directory: tests/db-testing/
|
|
|
|
- name: Rye sync
|
|
run: rye sync
|
|
working-directory: tests/db-testing/
|
|
|
|
- name: Start OpenObserve with Postgres
|
|
run: |
|
|
export ZO_META_STORE=postgres
|
|
export ZO_META_POSTGRES_DSN=postgres://postgres:password@localhost:5432/postgres
|
|
export ZO_TEXT_DATA_TYPE=text
|
|
export ZO_MEM_PERSIST_INTERVAL=1
|
|
export ZO_MAX_FILE_RETENTION_TIME=1
|
|
export ZO_FILE_PUSH_INTERVAL=1
|
|
target/debug/openobserve > o2_postgres.log 2>&1 &
|
|
SERVER_PID=$!
|
|
echo "SERVER_PID=$SERVER_PID" >> $GITHUB_ENV
|
|
echo "OpenObserve PID: $SERVER_PID"
|
|
|
|
- name: Wait for OpenObserve to start
|
|
run: |
|
|
echo "Waiting for OpenObserve to be ready..."
|
|
max_attempts=30
|
|
attempt=0
|
|
while [ $attempt -lt $max_attempts ]; do
|
|
if curl -s -f http://localhost:5080/healthz > /dev/null 2>&1; then
|
|
echo "OpenObserve is ready!"
|
|
break
|
|
fi
|
|
attempt=$((attempt + 1))
|
|
echo "Attempt $attempt/$max_attempts - waiting..."
|
|
sleep 2
|
|
done
|
|
if [ $attempt -eq $max_attempts ]; then
|
|
echo "OpenObserve failed to start"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run DB validation tests
|
|
run: |
|
|
# Export database connection info for tests
|
|
export ZO_META_POSTGRES_DSN=postgres://postgres:password@localhost:5432/postgres
|
|
|
|
# Run pytest with verbose output
|
|
rye run pytest -v --tb=short
|
|
working-directory: tests/db-testing/
|
|
|
|
- name: Stop OpenObserve
|
|
if: always()
|
|
run: |
|
|
if [ ! -z "$SERVER_PID" ]; then
|
|
kill $SERVER_PID || true
|
|
fi
|
|
|
|
- name: Upload OpenObserve logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: openobserve-logs
|
|
path: o2_postgres.log
|
|
retention-days: 5
|
|
|
|
db_tests_summary:
|
|
runs-on: ubuntu-latest
|
|
permissions: {}
|
|
needs: [check_changes, db_validation_tests]
|
|
if: always()
|
|
steps:
|
|
- name: Check test results
|
|
run: |
|
|
if [ "${{ needs.check_changes.result }}" != "success" ]; then
|
|
echo "check_changes job did not succeed: ${{ needs.check_changes.result }}"
|
|
exit 1
|
|
fi
|
|
if [ "${{ needs.db_validation_tests.result }}" == "success" ] || [ "${{ needs.db_validation_tests.result }}" == "skipped" ]; then
|
|
echo "DB validation tests passed or skipped"
|
|
exit 0
|
|
else
|
|
echo "DB validation tests failed"
|
|
exit 1
|
|
fi
|