:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
test(dagster): reset clickhouse between dagster tests only when dirty (#87220)
Paul D'Ambra1e37ce35cbc7
diff --git a/posthog/dags/tests/conftest.py b/posthog/dags/tests/conftest.pyindex 08b093737411..31278f60097a 100644--- a/posthog/dags/tests/conftest.py+++ b/posthog/dags/tests/conftest.py@@ -8,7 +8,7 @@ from datetime import datetimefrom uuid import UUIDimport pytest-from posthog.test.base import reset_clickhouse_database+from posthog.test.base import reset_clickhouse_database, reset_clickhouse_database_if_dirtyfrom unittest.mock import patchfrom django.conf import settings@@ -94,6 +94,9 @@ def cluster(django_db_setup) -> Iterator[ClickhouseCluster]:Cluster fixture with macOS Docker-compatible hostname resolution.Patches ClickhouseCluster to use host_name instead of host_address."""+ # Setup reset stays unconditional (Kafka-engine arrivals don't advance the+ # dirty counter, so a late row would leak into the next test); teardown can+ # skip when nothing checked out a ClickHouse client.reset_clickhouse_database()try:with patch.object(@@ -103,4 +106,4 @@ def cluster(django_db_setup) -> Iterator[ClickhouseCluster]:):yield get_cluster()finally:- reset_clickhouse_database()+ reset_clickhouse_database_if_dirty()