: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(async-migrations): start async migration tests from an empty events table (#125568)
Patricio9c64e88c3b2d
diff --git a/posthog/management/commands/test/test_run_async_migrations.py b/posthog/management/commands/test/test_run_async_migrations.pyindex f3f182590d9b..0e1eea4c019e 100644--- a/posthog/management/commands/test/test_run_async_migrations.py+++ b/posthog/management/commands/test/test_run_async_migrations.py@@ -7,11 +7,20 @@ from django.core.management import call_commandfrom semantic_version.base import Versionfrom posthog.async_migrations.setup import ALL_ASYNC_MIGRATIONS+from posthog.clickhouse.client import sync_executefrom posthog.constants import FROZEN_POSTHOG_VERSION+from posthog.models.event.sql import TRUNCATE_EVENTS_TABLE_SQLpytestmark = pytest.mark.django_db[email protected](autouse=True)+def truncate_events():+ # Events another test left without person data make 0007 required, and it can't run against the+ # test ClickHouse, so start from an empty events table.+ sync_execute(TRUNCATE_EVENTS_TABLE_SQL())++def test_run_async_migrations_doesnt_raise():call_command("run_async_migrations")