@@ -441,15 +441,31 @@ export const containerTest = test.extend<ContainerTestContext>({
441441// For tests that exercise the Postgres -> ClickHouse logical-replication pipeline (WAL slots,
442442// publications, REPLICA IDENTITY). These need a dedicated Postgres per test - the worker-scoped +
443443// template-clone model used by containerTest doesn't carry logical replication across cloned dbs.
444- // Everything is per-test here (fully isolated, same as the pre-scoping containerTest).
445- export const replicationContainerTest = test . extend < ContainerContext > ( {
444+ // ONLY postgres needs to be per-test (the WAL slot/publication lives in the db it writes to). Redis
445+ // and ClickHouse are still worker-scoped + reset per test - the pipeline writes pg->clickhouse and a
446+ // shared+truncated clickhouse is fine - so we only pay a postgres boot per test, not all three.
447+ type ReplicationContainerTestContext = {
448+ network : StartedNetwork ;
449+ postgresContainer : StartedPostgreSqlContainer ;
450+ prisma : PrismaClient ;
451+ redisContainer : StartedRedisContainer ;
452+ resetRedis : void ;
453+ redisOptions : RedisOptions ;
454+ clickhouseContainer : StartedClickHouseContainer ;
455+ resetClickhouse : void ;
456+ clickhouseClient : ClickHouseClient ;
457+ } ;
458+
459+ export const replicationContainerTest = test . extend < ReplicationContainerTestContext > ( {
446460 network,
447461 postgresContainer,
448462 prisma,
449- redisContainer,
463+ redisContainer : [ bootWorkerRedis , { scope : "worker" } ] ,
464+ resetRedis : [ flushRedis , { auto : true } ] ,
450465 redisOptions,
451- clickhouseContainer,
452- clickhouseClient,
466+ clickhouseContainer : [ bootWorkerClickhouse , { scope : "worker" } ] ,
467+ resetClickhouse : [ truncateClickhouseFixture , { auto : true } ] ,
468+ clickhouseClient : scopedClickhouseClient ,
453469} ) ;
454470
455471export const containerWithElectricTest = test . extend < ContainerWithElectricContext > ( {
0 commit comments