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(ingestion): deflake e2e tests (#64357)

Zach Brownf01ea5ae6a74
diff --git a/nodejs/src/ingestion/clientwarnings/consumer-e2e.test.ts b/nodejs/src/ingestion/clientwarnings/consumer-e2e.test.ts
index 62acc66be5d8..123dcf717356 100644
--- a/nodejs/src/ingestion/clientwarnings/consumer-e2e.test.ts
+++ b/nodejs/src/ingestion/clientwarnings/consumer-e2e.test.ts
@@ -10,7 +10,7 @@ import {
fetchIngestionWarnings,
waitForClickHouseKafkaConsumer,
} from '~/tests/helpers/ingestion-e2e'
-import { resetKafka } from '~/tests/helpers/kafka'
+import { TEST_KAFKA_TOPICS, ensureKafkaTopics } from '~/tests/helpers/kafka'
import { resetTestDatabase } from '~/tests/helpers/sql'
import { getDefaultKafkaDownstreamProducerEnvConfig, getDefaultKafkaUpstreamProducerEnvConfig } from '../common/config'
@@ -109,7 +109,7 @@ describe('ClientWarnings consumer E2E', () => {
beforeAll(async () => {
clickhouse = Clickhouse.create()
- await resetKafka()
+ await ensureKafkaTopics(TEST_KAFKA_TOPICS)
await resetTestDatabase()
await clickhouse.resetTestDatabase()
await waitForClickHouseKafkaConsumer(clickhouse)
diff --git a/nodejs/src/ingestion/heatmaps/consumer-e2e.test.ts b/nodejs/src/ingestion/heatmaps/consumer-e2e.test.ts
index 30155fef6218..0c95ffde4808 100644
--- a/nodejs/src/ingestion/heatmaps/consumer-e2e.test.ts
+++ b/nodejs/src/ingestion/heatmaps/consumer-e2e.test.ts
@@ -9,7 +9,7 @@ import {
createTestWithTeamIngester,
waitForClickHouseKafkaConsumer,
} from '~/tests/helpers/ingestion-e2e'
-import { resetKafka } from '~/tests/helpers/kafka'
+import { TEST_KAFKA_TOPICS, ensureKafkaTopics } from '~/tests/helpers/kafka'
import { resetTestDatabase } from '~/tests/helpers/sql'
import { getDefaultKafkaDownstreamProducerEnvConfig, getDefaultKafkaUpstreamProducerEnvConfig } from '../common/config'
@@ -114,7 +114,7 @@ describe('Heatmaps consumer E2E', () => {
beforeAll(async () => {
clickhouse = Clickhouse.create()
- await resetKafka()
+ await ensureKafkaTopics(TEST_KAFKA_TOPICS)
await resetTestDatabase()
await clickhouse.resetTestDatabase()
await waitForClickHouseKafkaConsumer(clickhouse)
diff --git a/nodejs/src/ingestion/person-properties-metadata.e2e.test.ts b/nodejs/src/ingestion/person-properties-metadata.e2e.test.ts
index 4a0de538a578..a27320da16e5 100644
--- a/nodejs/src/ingestion/person-properties-metadata.e2e.test.ts
+++ b/nodejs/src/ingestion/person-properties-metadata.e2e.test.ts
@@ -11,7 +11,7 @@ import { Message } from 'node-rdkafka'
import { v4 } from 'uuid'
import { waitForExpect } from '~/tests/helpers/expectations'
-import { resetKafka } from '~/tests/helpers/kafka'
+import { TEST_KAFKA_TOPICS, ensureKafkaTopics } from '~/tests/helpers/kafka'
import { createTestIngestionOutputs, createTestMonitoringOutputs } from '../../tests/helpers/ingestion-outputs'
import { createUserTeamAndOrganization, fetchPostgresPersons, resetTestDatabase } from '../../tests/helpers/sql'
@@ -211,7 +211,7 @@ describe('Person properties_last_updated_at and properties_last_operation behavi
const testWithTeamIngester = createTestWithTeamIngester()
beforeAll(async () => {
- await resetKafka()
+ await ensureKafkaTopics(TEST_KAFKA_TOPICS)
await resetTestDatabase()
process.env.SITE_URL = 'https://example.com'
})
diff --git a/nodejs/src/ingestion/person-updates-e2e.test.ts b/nodejs/src/ingestion/person-updates-e2e.test.ts
index a89f11cba08e..998fd9546d57 100644
--- a/nodejs/src/ingestion/person-updates-e2e.test.ts
+++ b/nodejs/src/ingestion/person-updates-e2e.test.ts
@@ -16,7 +16,7 @@ import { Message } from 'node-rdkafka'
import { v4 } from 'uuid'
import { waitForExpect } from '~/tests/helpers/expectations'
-import { resetKafka } from '~/tests/helpers/kafka'
+import { TEST_KAFKA_TOPICS, ensureKafkaTopics } from '~/tests/helpers/kafka'
import { Clickhouse } from '../../tests/helpers/clickhouse'
import { createTestIngestionOutputs, createTestMonitoringOutputs } from '../../tests/helpers/ingestion-outputs'
@@ -178,7 +178,7 @@ describe.each(FLAG_COMBINATIONS)('Person Updates E2E ($#)', (config) => {
beforeAll(async () => {
clickhouse = Clickhouse.create()
- await resetKafka()
+ await ensureKafkaTopics(TEST_KAFKA_TOPICS)
await resetTestDatabase()
await clickhouse.resetTestDatabase()
})
diff --git a/nodejs/src/session-recording/consumer.e2e.test.ts b/nodejs/src/session-recording/consumer.e2e.test.ts
index cfe1f0a0dd0b..6b47e312e432 100644
--- a/nodejs/src/session-recording/consumer.e2e.test.ts
+++ b/nodejs/src/session-recording/consumer.e2e.test.ts
@@ -11,7 +11,7 @@ import { v4 as uuidv4 } from 'uuid'
import { Clickhouse } from '../../tests/helpers/clickhouse'
import { waitForExpect } from '../../tests/helpers/expectations'
-import { resetKafka } from '../../tests/helpers/kafka'
+import { TEST_KAFKA_TOPICS, ensureKafkaTopics } from '../../tests/helpers/kafka'
import { forSnapshot } from '../../tests/helpers/snapshots'
import { createOrganization, createTeam, getFirstTeam, resetTestDatabase } from '../../tests/helpers/sql'
import { defaultConfig, overrideWithEnv } from '../config/config'
@@ -949,7 +949,7 @@ describe('Session Recording Consumer Integration', () => {
)
}
- await resetKafka()
+ await ensureKafkaTopics(TEST_KAFKA_TOPICS)
await resetTestDatabase()
hub = await createHub({