ci(api): Add ClickHouse to the local and CI test stack#7848
Conversation
Stand up a real ClickHouse so segment-membership code can be tested against actual ClickHouse execution instead of a mocked cursor. - Add a clickhouse service (clickhouse-server:25.12, matching ClickHouse Cloud) to docker-compose.local.yml, so it comes up for `make test` both locally and in CI. - Wire CLICKHOUSE_* into .env-ci/.env-local and wait for it in `make wait-for-db`. - Add a `clickhouse_db` fixture and a `clickhouse` marker. ClickHouse has no transactional rollback, so the fixture truncates IDENTITIES on teardown for per-test isolation. - Move the segment-membership tests that stubbed out ClickHouse -- compute, refresh, backfill, and log_comment attribution -- to live-ClickHouse integration tests; leave skip/defensive paths mocked.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression19 screenshots compared. See report for details. |
The upstream clickhouse_backend leaves _clone_test_db unimplemented, so setup_databases(parallel=...) raises NotImplementedError and aborts the whole session under `pytest -n auto`. Add a thin backend subclass that clones the primary test database per xdist worker, and point the engine at it. beep boop
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7848 +/- ##
=======================================
Coverage 98.59% 98.59%
=======================================
Files 1467 1472 +5
Lines 57332 57370 +38
=======================================
+ Hits 56525 56564 +39
+ Misses 807 806 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
emyller
left a comment
There was a problem hiding this comment.
Looks fine; few non-blocking questions.
Co-authored-by: Evandro Myller <[email protected]>
This read-endpoint test leaked into the ClickHouse test-stack branch and references segment_membership.services.get_segment_members, which doesn't exist here. Remove it so the PR only contains ClickHouse changes. beep boop
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Contributes to #7408
Stands up a real ClickHouse in the test stack so segment membership code can be tested against actual ClickHouse execution instead of a mocked cursor.
clickhouseservice todocker-compose.local.yml, so it comes up formake testboth locally and in CI.CLICKHOUSE_*into.env-ci/.env-local, and wait for it inmake wait-for-db. The suite targets the always-presentdefaultdatabase; the test runner creates its owntest_*database on top, so we don't depend on first-run DB init.clickhouse_dbfixture and aclickhousemarker. ClickHouse has no transactional rollback, so the fixture truncatesIDENTITIESon teardown for per-test isolation.log_commentattribution — to live-ClickHouse integration tests undertests/integration/segment_membership/. Skip/defensive branches that never reach ClickHouse stay mocked._clone_test_db. Without it,pytest --ciresults inNotImplementedError.How did you test this code?
make docker-upbrings up the newclickhouseservice alongside Postgres.make test opts='tests/integration/segment_membership/test_segment_membership_clickhouse.py tests/unit/segment_membership/'— all pass.Verified specifically:
-n0(two tests sharing one test DB both see the correct counts, confirming truncation-based isolation).0001_create_identitiesmigration (JSON-column DDL accepted underallow_experimental_json_type);make wait-for-dbwaits on ClickHouse.