test(NODE-7426): Add appName to OIDC test failpoints#4869
test(NODE-7426): Add appName to OIDC test failpoints#4869PavelSafronov wants to merge 3 commits intomongodb:mainfrom
Conversation
7cdb6ac to
553631d
Compare
| } | ||
|
|
||
| // Test descriptions use `appName` and `appname` interchangeably | ||
| if ( |
There was a problem hiding this comment.
You should not need to modify the unified test runner, since there was no change to the unified test runner specification. The appName for unified tests is already passed in directly via the spec files themselves.
You may find it helpful to look at the reference implementations linked in the spec PR (mongodb/specifications#1891), for example the python one here.
There was a problem hiding this comment.
Thanks for explaining, tests are updated and this change is reverted.
| }); | ||
|
|
||
| afterEach(async function () { | ||
| // explicitly remove the fail point to prevent interaction betweet test runs |
There was a problem hiding this comment.
The annotations are helpful, however, the new requirement in the spec is to ensure that we not only remove the failpoint but also always set the appName for any failpoint created. In this file, there are two types of clients - the regular one and the util client (with the util clients being used to set fail points), with some clients instantiated via new MongoClient and others via the getClient method, so we want to make sure that we always configure the clients being tested and the failpoints set in the test with an appName.
There was a problem hiding this comment.
Thanks for the explanation, added an appName generator and using that in tests, with the same app name for each pair of client and util clients.
- configured a distinct per-test appName - removed generated appName
There was a problem hiding this comment.
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: forbidto the unified OIDC no-retry spec test. - Configure a stable
appNamein the unified spec test client and includeappNamein failpointdata. - Update OIDC prose integration tests to generate unique
appNamevalues 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.
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { failCommands: ['find'], appName } |
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { failCommands: ['saslStart'], appName } |
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { failCommands: ['insert'], appName } |
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { | |
| failCommands: ['find'], | |
| appName | |
| } |
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { | |
| failCommands: ['find'], | |
| appName | |
| } |
| await utilClient.db().admin().command({ | ||
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } | ||
| }); |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| client = getClient({ promoteValues: false, appName }, callbackSpy); | ||
| utilClient = getClient({ promoteValues: false, appName }, createCallback()); | ||
| collection = client.db('test').collection('test'); | ||
| await utilClient | ||
| .db() |
There was a problem hiding this comment.
The failpoint configured in this test should be scoped with appName to avoid impacting other OIDC prose tests. In this describe block, the client is created with an appName but the failCommand configuration later in the setup does not include appName in its data, so the failpoint can apply globally.
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { failCommands: ['find'], appName } |
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { | |
| failCommands: ['insert'], | |
| appName | |
| } |
| configureFailPoint: 'failCommand', | ||
| mode: 'off' | ||
| mode: 'off', | ||
| data: { appName } |
There was a problem hiding this comment.
When disabling the failCommand failpoint, the command currently sends data: { appName } only. The server-side failCommand failpoint expects data.failCommands (see FailCommandFailPoint in test/tools/utils.ts), so this payload may be rejected or fail to disable the intended failpoint. Include the same failCommands (and appName) used when enabling the failpoint.
| data: { appName } | |
| data: { | |
| failCommands: ['find'], | |
| appName | |
| } |
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@4d11668Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript