Skip to content

test(scheduler): give each suite its own db schema and close its pool (NAN-6500) - #6988

Open
agusayerza wants to merge 1 commit into
masterfrom
agus/NAN-6500/scheduler-test-db-schema
Open

test(scheduler): give each suite its own db schema and close its pool (NAN-6500)#6988
agusayerza wants to merge 1 commit into
masterfrom
agus/NAN-6500/scheduler-test-db-schema

Conversation

@agusayerza

@agusayerza agusayerza commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

getTestDbClient hardcoded schema: 'scheduler', so all 10 call sites shared one schema. clearDatabase() runs DROP SCHEMA CASCADE, so a teardown in one file dropped the schema another was still using. That is where the Invalid state transition and expected +0 to be 1 failures came from. Each suite now passes its own.

None of these suites closed their knex pool either. DatabaseClient.destroy() existed but was never called, and four had no afterAll at all. At poolMax: 50 per client, nine live clients in one process exhaust Postgres and unrelated suites start failing with Failed to authenticate user.

With both fixed they no longer need their own process, so needsOwnProcess is back to just the vi.mock scan.

Related to NAN-6488.

Review in cubic

… (NAN-6500)

`getTestDbClient` hardcoded `schema: 'scheduler'` so all 10 call sites shared one schema.
`clearDatabase()` runs `DROP SCHEMA CASCADE`, so a teardown in one file dropped the schema
another was still using, which is where the `Invalid state transition` and
`expected +0 to be 1` failures came from. Each suite now passes its own.

None of them closed their knex pool either. `DatabaseClient.destroy()` existed but was
never called, and four suites had no `afterAll` at all. At `poolMax: 50` per client, nine
live clients in one process exhaust Postgres and unrelated suites start failing with
`Failed to authenticate user`.

With both fixed these suites no longer need their own process.
@linear-code

linear-code Bot commented Jul 31, 2026

Copy link
Copy Markdown

NAN-6500

NAN-6488

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 12 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@agusayerza
agusayerza requested review from a team and TBonnin July 31, 2026 19:23
@agusayerza
agusayerza marked this pull request as ready for review July 31, 2026 19:25
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.

1 participant