Skip to content

test(node-integration-tests): Reuse Docker Compose containers across tests#22128

Open
mydea wants to merge 10 commits into
developfrom
perf/docker-reuse-prototype
Open

test(node-integration-tests): Reuse Docker Compose containers across tests#22128
mydea wants to merge 10 commits into
developfrom
perf/docker-reuse-prototype

Conversation

@mydea

@mydea mydea commented Jul 9, 2026

Copy link
Copy Markdown
Member

Speeds up the Docker-backed node-integration-tests suites by bringing each Compose service up once per suite instead of once per test, and by removing redundant per-test setup work.

describeWithDockerCompose

Previously every test spun its own container up and down via runner.withDockerCompose(...), so a suite with N tests paid N × (docker compose down + up --wait healthcheck) — the dominant cost of these suites. The new describeWithDockerCompose(name, { workingDirectory }, () => { ... }) wrapper starts the container in a single beforeAll and tears it down once in afterAll; the inner tests no longer call withDockerCompose() themselves. withDockerCompose() (and the now-unused DockerOptions.setupCommand) has been removed from createRunner.

Migrated suites: amqplib, ioredis-dc, kafkajs, knex (mysql2/pg), mysql2, mysql2-tracing-channel, postgres, postgres-streamed, postgresjs, prisma v5/v6/v7, redis, redis-cache, redis-dc, tedious.

Prisma: stop running prisma generate/migrate on every test

  • migrate → Postgres init script. Each Prisma docker-compose.yml now bind-mounts the committed migration.sql into /docker-entrypoint-initdb.d/, so the schema is created on container init. The runtime prisma migrate dev step is gone entirely.
  • generate → once per suite. New afterSetupCommand option on createEsmAndCjsTests' CommonTestOptions runs a command once in the tmp dir after additionalDependencies are installed (with node_modules/.bin on PATH). The Prisma suites use it for prisma generate (v7 also runs tsc), instead of running it inside the per-test Docker setup command.

Flaky tests fixed

These Docker-backed suites flaked with an opaque Test timed out: on the previous per-test model, docker compose up --wait (DB healthcheck / cold start — slowest for MSSQL) ran inside the per-test timeout, so on a loaded runner the budget was exhausted before the scenario could emit its envelope. Moving Docker startup into beforeAll removes it from the per-test budget, fixing the whole class.

Fixes #22122
Fixes #22117
Fixes #22114
Fixes #22109
Fixes #22110
Fixes #22082
Fixes #22135
Fixes #22078
Fixes #22031
Fixes #22030
Fixes #21698
Fixes #21724

Other test changes

Some tests needed adjustments to make sure we drop tables that have been created again (as multiple tests share a DB instance now). While at this I also hardended the tests a bit by using random emails instead of fixed ones - this alone is not enough because we also check the table creation spans, but IMHO that is fine either way (we could revisit this later).

🤖 Generated with Claude Code

Comment thread dev-packages/node-integration-tests/suites/tracing/postgres/test.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d5ba5d2. Configure here.

Comment thread dev-packages/node-integration-tests/suites/tracing/knex/mysql2/scenario.mjs Outdated
@mydea mydea marked this pull request as ready for review July 9, 2026 09:02
@mydea mydea requested a review from a team as a code owner July 9, 2026 09:02
@mydea mydea requested review from JPeer264 and andreiborza and removed request for a team July 9, 2026 09:02
@mydea mydea force-pushed the perf/docker-reuse-prototype branch from acc254b to 9ab3366 Compare July 9, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flaky CI]: Node (Orchestrion) Integration Tests - suites/tracing/tedious/test.ts > tedious auto instrumentation > should auto-instrument tedious package [esm] [Flaky CI]: Node Integration Tests - suites/tracing/postgresjs/test.ts > postgresjs auto instrumentation > basic > should auto-instrument postgres package [esm] [Flaky CI]: Node Integration Tests - suites/tracing/redis-cache/test.ts > redis cache auto instrumentation > ioredis non-cache keys > should not add cache spans when key is not prefixed [esm] [Flaky CI]: Node Integration Tests - suites/tracing/amqplib-v1/test.ts > amqplib v1 auto-instrumentation > should be able to send and receive messages with amqplib v1 [esm] [Flaky CI]: Node Integration Tests - suites/tracing/redis-cache/test.ts > redis cache auto instrumentation > ioredis non-cache keys > esm/cjs > should not add cache spans when key is not prefixed

1 participant