fix(ingestion): mv acceptance tests to query CH directly#53825
Merged
nickbest-ph merged 2 commits intomasterfrom Apr 9, 2026
Merged
fix(ingestion): mv acceptance tests to query CH directly#53825nickbest-ph merged 2 commits intomasterfrom
nickbest-ph merged 2 commits intomasterfrom
Conversation
Contributor
|
jose-sequeira
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ingestion acceptance tests (a Temporal scheduled workflow that runs every 10 minutes) query ClickHouse via the PostHog HogQL API, authenticated with a personal API key. This adds an unnecessary dependency on the web tier being healthy and requires managing a
PERSONAL_API_KEYcredential. Since the only goal of these tests is to verify that events land in ClickHouse, we can query ClickHouse directly from the Temporal worker, which already has ClickHouse credentials via Django settings.Changes
config.py: Removedpersonal_api_keyandproject_idfields, addedteam_id: int(env var:INGESTION_ACCEPTANCE_TEST_TEAM_ID)client.py: Replaced HTTP session + HogQL API queries withsync_executefromposthog.clickhouse.client.execute. Queries now go directly to ClickHouse using real table names (events,person,person_distinct_id2) withteam_idfiltering. Removed all HTTP query infrastructure (_create_http_session,_execute_hogql_query,_execute_hogql_query_all, HTTP retry/resilience config)activities.py,__main__.py,slack.py,terminal_report.py: Updated references fromproject_idtoteam_idREADME.md: Updated architecture diagram, configuration table, and descriptions to reflect direct ClickHouse queriessync_executeinstead of HTTP responses, updated allConfigfixtures to useteam_idinstead ofproject_id/personal_api_keyDeployment note: Env var changes required:
INGESTION_ACCEPTANCE_TEST_PERSONAL_API_KEY,INGESTION_ACCEPTANCE_TEST_PROJECT_IDINGESTION_ACCEPTANCE_TEST_TEAM_IDHow did you test this code?
All 36 unit tests pass (
pytest posthog/temporal/tests/ingestion_acceptance_test/ -v). Linting passes withruff checkandruff format --check.