Skip to content

test: check server warnings after each e2e test COMPASS-10017#7845

Merged
paula-stacho merged 15 commits intomainfrom
COMPASS-10017
Mar 19, 2026
Merged

test: check server warnings after each e2e test COMPASS-10017#7845
paula-stacho merged 15 commits intomainfrom
COMPASS-10017

Conversation

@paula-stacho
Copy link
Copy Markdown
Collaborator

@paula-stacho paula-stacho commented Mar 5, 2026

Description

Following mongodb-js/mongosh#2574

Added exceptions for warnings that we run into now. There is a global exceptions list, other exceptions can be added & removed at runtime.
I tried to keep them specific if possible, so that we'll see if something new is introduced.

Note: do hide whitespaces for review

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@paula-stacho paula-stacho added the no release notes Fix or feature not for release notes label Mar 5, 2026
@paula-stacho paula-stacho marked this pull request as ready for review March 9, 2026 09:07
@paula-stacho paula-stacho requested a review from a team as a code owner March 9, 2026 09:07
@paula-stacho paula-stacho requested review from Copilot and nbbeeken March 9, 2026 09:07
@paula-stacho paula-stacho requested a review from addaleax March 9, 2026 09:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an automated guardrail to the Compass e2e test harness to fail tests when MongoDB server logs emit unexpected warnings/errors, with mechanisms to allowlist known/expected warnings in a scoped way.

Changes:

  • Introduces ServerLogsChecker in @mongodb-js/compass-test-server and re-exports it for use by test infrastructure.
  • Wires server log checking into the e2e runner (global setup creates checkers; root hook runs a checkpoint after each test).
  • Updates e2e tests to use the new mongo-clients helper import path and adds scoped allowlists for tests that intentionally trigger server warnings.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/compass-test-server/src/server-logs-checker.ts New server log warning checker
packages/compass-test-server/src/index.ts Export checker and types
packages/compass-e2e-tests/tests/time-to-first-query.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/tabs.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/read-write.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/read-only.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/my-queries-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/instance-sidebar.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/instance-databases-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/database-collections-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/data-modeling-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-validation-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-schema-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-rename.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-indexes-tab.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-import.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-heading.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-export.test.ts Add scoped server-warning allowlist
packages/compass-e2e-tests/tests/collection-documents-tab.test.ts Add scoped server-warning allowlists
packages/compass-e2e-tests/tests/collection-bulk-update.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-bulk-delete.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-ai-query.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/collection-aggregations-tab.test.ts Add scoped server-warning allowlists
packages/compass-e2e-tests/tests/atlas-cloud/rolling-indexes.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/atlas-cloud/global-writes.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/tests/atlas-cloud/collection-ai-query.test.ts Switch helper import to mongo-clients
packages/compass-e2e-tests/index.ts Use mochaRootHooks from mongo-clients
packages/compass-e2e-tests/helpers/test-runner-global-fixtures.ts Create/close log checkers + allowlists
packages/compass-e2e-tests/helpers/mongo-clients.ts Add afterEach server-warning checkpoint

@paula-stacho paula-stacho changed the title test: check server warnings after each e2e test test: check server warnings after each e2e test COMPASS-10017 Mar 9, 2026
* Monitors MongoDB server logs and validates that no unexpected warnings occur.
* Modeled after the mongosh implementation in PR #2574.
*/
export class ServerLogsChecker {
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.

Do we want to put this file into devtools-shared? We're almost certainly going to end up using the same code in mongosh

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.

].includes(l.attr?.error?.codeName)
);
},
];
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.

This should maybe include a few more warnings from the mongosh version of the PR

I'll create a suggestion for a PR to add this to devtools-shared

@nbbeeken nbbeeken removed their request for review March 9, 2026 20:10
@paula-stacho paula-stacho merged commit 2d730ac into main Mar 19, 2026
54 of 56 checks passed
@paula-stacho paula-stacho deleted the COMPASS-10017 branch March 19, 2026 11:55
paula-stacho added a commit that referenced this pull request Mar 24, 2026
…er package (#7890)

* chore(compass-test-server): switch to shared mongodb-server-log-checker package

Refs: #7845 (comment)

* update server-log-checker

---------

Co-authored-by: Paula Stachova <paula.stachova@mongodb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants