Skip to content

fix(mongodb-schema): increase timeout for MongoDB cluster teardown in integration test - #846

Draft
mabaasit with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-check-and-test-job-failure
Draft

fix(mongodb-schema): increase timeout for MongoDB cluster teardown in integration test#846
mabaasit with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-check-and-test-job-failure

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The "after all" hook in the "With a MongoDB Cluster" integration test suite was intermittently timing out in CI. The root cause: mochaTestServer's after hook — which kills the MongoDB server process and recursively deletes its data directory — has no explicit timeout of its own, so it inherits the suite's this.timeout(30_000). On CI, this cleanup routinely exceeds 30 seconds.

(mochaTestServer's before hook already does the right thing with this.timeout(500_000); its after hook does not.)

Changes

  • test/integration/generate-and-validate.test.ts
    • Increase suite timeout from 30_000120_000 ms so mochaTestServer's inherited cleanup budget is sufficient
    • Add explicit this.timeout(60_000) inside the test's own after hook (MongoClient.close()) for clarity
-  this.timeout(30_000);
+  this.timeout(120_000);
 
   after(async function () {
+    this.timeout(60_000);
     await client?.close();
   });

Copilot AI review requested due to automatic review settings July 31, 2026 10:25

Copilot AI 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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

The `after all` hook in the `With a MongoDB Cluster` suite was timing
out because `mochaTestServer`'s `after` hook (which calls
`cluster.close()` to stop the MongoDB server and clean up data files)
was inheriting the suite's 30-second timeout. Shutting down a MongoDB
server process and removing its data files can take longer than 30
seconds in CI environments.

Fix:
- Increase the suite timeout from 30s to 120s so that
  `mochaTestServer`'s `after` hook has enough time to complete cleanup
- Add an explicit `this.timeout(60_000)` to the test's own `after`
  hook for clarity
Copilot AI changed the title [WIP] Fix failing GitHub Actions job Check and Test (ubuntu-latest, 3) fix(mongodb-schema): increase timeout for MongoDB cluster teardown in integration test Jul 31, 2026
Copilot AI requested a review from mabaasit July 31, 2026 10:34
});

describe('With a MongoDB Cluster', function () {
this.timeout(30_000);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was about to actually revert this since the extra time didn't help. Do you want to test with the longer timeout before?

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.

4 participants