Skip to content

: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.

chore(tests): fix master tests broken by schema validation and tile prefetch (#120029)

Alex V4310a0a2b5a9
diff --git a/posthog/test/activity_logging/test_external_data_schema_activity_logging.py b/posthog/test/activity_logging/test_external_data_schema_activity_logging.py
index 1aa22e6578f2..115d93946243 100644
--- a/posthog/test/activity_logging/test_external_data_schema_activity_logging.py
+++ b/posthog/test/activity_logging/test_external_data_schema_activity_logging.py
@@ -49,7 +49,7 @@ class TestExternalDataSchemaActivityLogging(ActivityLogTestHelper):
self.clear_activity_logs()
- self.update_external_data_schema(str(schema.id), {"should_sync": False, "sync_type": "incremental"})
+ self.update_external_data_schema(str(schema.id), {"should_sync": False})
activity_logs = self.get_activity_logs_for_item("ExternalDataSchema", str(schema.id))
self.assertEqual(len(activity_logs), 1)
diff --git a/products/access_control/backend/tests/test_access_control.py b/products/access_control/backend/tests/test_access_control.py
index 8cade81a9d13..262ea3e6d7fb 100644
--- a/products/access_control/backend/tests/test_access_control.py
+++ b/products/access_control/backend/tests/test_access_control.py
@@ -4,6 +4,7 @@ import uuid
from unittest.mock import MagicMock, patch
from django.apps import apps
+from django.contrib.contenttypes.models import ContentType
from django.db import connection
from django.test.utils import CaptureQueriesContext
from django.utils.timezone import now
@@ -1227,6 +1228,9 @@ class TestAccessControlQueryCounts(BaseAccessControlTest):
# Baseline call to trigger caching of one off things like instance settings
self.client.get(f"/api/projects/@current/notebooks/{self.notebook.short_id}")
+ # Tag lookups read content types through a process-wide cache. Fill it here so the counts
+ # do not depend on which tests ran before in the same worker.
+ ContentType.objects.get_for_models(Dashboard, FeatureFlag)
def test_query_counts(self):
self._org_membership(OrganizationMembership.Level.MEMBER)
@@ -1237,7 +1241,7 @@ class TestAccessControlQueryCounts(BaseAccessControlTest):
# Baseline query (triggers any first time cache things)
self.client.get(f"/api/projects/@current/notebooks/{self.notebook.short_id}")
- baseline = 18
+ baseline = 17
# Access controls total 2 extra queries - 1 for org membership, 1 for the user roles, 1 for the preloaded access controls
with self.assertNumQueries(baseline + 4):
@@ -1280,7 +1284,7 @@ class TestAccessControlQueryCounts(BaseAccessControlTest):
# Baseline query (triggers any first time cache things)
self.client.get(f"/api/projects/@current/notebooks/{self.notebook.short_id}")
- baseline = 17
+ baseline = 16
# Access controls total 2 extra queries - 1 for org membership, 1 for the user roles, 1 for the preloaded access controls
with self.assertNumQueries(baseline + 5):