Skip to content

test(NODE-7426): Add appName to OIDC test failpoints#4869

Merged
dariakp merged 6 commits intomongodb:mainfrom
PavelSafronov:NODE-7426
Mar 20, 2026
Merged

test(NODE-7426): Add appName to OIDC test failpoints#4869
dariakp merged 6 commits intomongodb:mainfrom
PavelSafronov:NODE-7426

Conversation

@PavelSafronov
Copy link
Contributor

@PavelSafronov PavelSafronov commented Feb 9, 2026

Description

Summary of Changes

Updated OIDC test specs.
Double-checked that failpoints are being removed
Updated UnifiedMongoClient to always configure an appName, as either a passed-in value or a unique identifier, as called out for OIDC tests in mongodb/specifications@4d11668

Double check the following

  • Lint is passing (npm run check:lint)
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@PavelSafronov PavelSafronov marked this pull request as ready for review February 10, 2026 20:07
@PavelSafronov PavelSafronov requested a review from a team as a code owner February 10, 2026 20:07
@dariakp dariakp self-assigned this Feb 18, 2026
@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Feb 18, 2026
- configured a distinct per-test appName
- removed generated appName
Copilot AI review requested due to automatic review settings February 20, 2026 22:22
Copy link
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

Updates OIDC authentication tests to scope server failpoints by appName (per updated OIDC spec guidance) and to explicitly clean up failpoints between test runs, reducing cross-test interference.

Changes:

  • Add serverless: forbid to the unified OIDC no-retry spec test.
  • Configure a stable appName in the unified spec test client and include appName in failpoint data.
  • Update OIDC prose integration tests to generate unique appName values per describe block, pass them to clients, and attempt explicit failpoint teardown.

Reviewed changes

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

File Description
test/spec/auth/unified/mongodb-oidc-no-retry.yml Adds serverless: forbid, introduces appName anchor, and scopes failpoints via appName.
test/spec/auth/unified/mongodb-oidc-no-retry.json JSON equivalent of the unified spec updates (serverless forbid, appName, appName-scoped failpoints).
test/integration/auth/mongodb_oidc.prose.test.ts Adds per-test appName generation, passes appName into clients and failpoints, and adds explicit failpoint cleanup (with issues noted in PR comments).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- typos fixed
- appName added in spots it was missing
@PavelSafronov
Copy link
Contributor Author

@tadjik1 FYI Copilot concerns addressed (most of the comments are wrong about appName), tests are passing.

client = getClient({}, callbackSpy);
utilClient = getClient({}, createCallback());
client = getClient({ appName }, callbackSpy);
utilClient = getClient({ appName }, createCallback());
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we only want to set the appName on the client and not the utilClient, since the utilClient isn't the client under test. @nbbeeken can you check me on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, the appname is the thing the server is using to apply the failcommand or not, every connection to MongoDB starts with a hello that includes the client metadata (thus the appname). So that's how the failcommand gets filtered properly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, the test client must have the appName applied to it, while the util client needs to pass the appName to the various configureFailPoint commands. Updated.

@dariakp dariakp self-requested a review March 13, 2026 20:59
@dariakp dariakp added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Mar 13, 2026
tadjik1
tadjik1 previously approved these changes Mar 18, 2026
Copy link
Member

@tadjik1 tadjik1 left a comment

Choose a reason for hiding this comment

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

Nicely done @PavelSafronov!


describe('3.3 Unexpected error code does not clear the cache', function () {
let utilClient: MongoClient;
const appName = createAppName();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to assign appName inside the beforeEach? I know right now we have a single it block per describe, so it's basically the same thing, but if we were ever to expand these, it could lead to the appName being shared between 2 it-blocks; if we're truly aiming to have a unique name per created test client, we should capture that intention by putting the logic inside the the beforeEach where the clients themselves are created

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely. We should be recreating the app name every time we create a new client. Updated.

@dariakp dariakp merged commit 7be12ee into mongodb:main Mar 20, 2026
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team Review Needs review from team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants