From 5d3d3fc2f3d4c25402f529ab4a7ad673c1d49794 Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Mon, 9 Feb 2026 10:13:20 -0800 Subject: [PATCH 1/3] test(NODE-7426): Add appName to OIDC test failpoints --- .../auth/unified/mongodb-oidc-no-retry.json | 21 ++++++++++++------- .../auth/unified/mongodb-oidc-no-retry.yml | 11 ++++++++-- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/test/spec/auth/unified/mongodb-oidc-no-retry.json b/test/spec/auth/unified/mongodb-oidc-no-retry.json index 9dbe1982704..b32ada172a4 100644 --- a/test/spec/auth/unified/mongodb-oidc-no-retry.json +++ b/test/spec/auth/unified/mongodb-oidc-no-retry.json @@ -5,7 +5,8 @@ { "minServerVersion": "7.0", "auth": true, - "authMechanism": "MONGODB-OIDC" + "authMechanism": "MONGODB-OIDC", + "serverless": "forbid" } ], "createEntities": [ @@ -24,7 +25,8 @@ "$$placeholder": 1 }, "retryReads": false, - "retryWrites": false + "retryWrites": false, + "appName": "mongodb-oidc-no-retry" }, "observeEvents": [ "commandStartedEvent", @@ -146,7 +148,8 @@ "failCommands": [ "find" ], - "errorCode": 391 + "errorCode": 391, + "appName": "mongodb-oidc-no-retry" } } } @@ -211,7 +214,8 @@ "failCommands": [ "insert" ], - "errorCode": 391 + "errorCode": 391, + "appName": "mongodb-oidc-no-retry" } } } @@ -288,7 +292,8 @@ "failCommands": [ "insert" ], - "closeConnection": true + "closeConnection": true, + "appName": "mongodb-oidc-no-retry" } } } @@ -320,7 +325,8 @@ "failCommands": [ "saslStart" ], - "errorCode": 18 + "errorCode": 18, + "appName": "mongodb-oidc-no-retry" } } } @@ -397,7 +403,8 @@ "failCommands": [ "saslStart" ], - "errorCode": 18 + "errorCode": 18, + "appName": "mongodb-oidc-no-retry" } } } diff --git a/test/spec/auth/unified/mongodb-oidc-no-retry.yml b/test/spec/auth/unified/mongodb-oidc-no-retry.yml index 426fd72466c..dbfe4ef79e6 100644 --- a/test/spec/auth/unified/mongodb-oidc-no-retry.yml +++ b/test/spec/auth/unified/mongodb-oidc-no-retry.yml @@ -5,6 +5,7 @@ runOnRequirements: - minServerVersion: "7.0" auth: true authMechanism: "MONGODB-OIDC" + serverless: forbid createEntities: - client: id: &failPointClient failPointClient @@ -20,6 +21,7 @@ createEntities: authMechanismProperties: { $$placeholder: 1 } retryReads: false retryWrites: false + appName: &appName mongodb-oidc-no-retry observeEvents: - commandStartedEvent - commandSucceededEvent @@ -86,6 +88,7 @@ tests: failCommands: - find errorCode: 391 # ReauthenticationRequired + appName: *appName - name: find object: collection0 arguments: @@ -120,6 +123,7 @@ tests: failCommands: - insert errorCode: 391 # ReauthenticationRequired + appName: *appName - name: insertOne object: collection0 arguments: @@ -159,6 +163,7 @@ tests: failCommands: - insert closeConnection: true + appName: *appName - name: insertOne object: collection0 arguments: @@ -179,6 +184,7 @@ tests: failCommands: - saslStart errorCode: 18 + appName: *appName - name: insertOne object: collection0 arguments: @@ -212,12 +218,13 @@ tests: client: failPointClient failPoint: configureFailPoint: failCommand - mode: + mode: times: 1 data: failCommands: - saslStart errorCode: 18 + appName: *appName - name: insertOne object: collection0 arguments: @@ -225,4 +232,4 @@ tests: _id: 1 x: 1 expectError: - errorCode: 18 \ No newline at end of file + errorCode: 18 From 553631dc7de40d0b5899cb73c59be2acaf8ac57f Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Tue, 10 Feb 2026 11:56:31 -0800 Subject: [PATCH 2/3] removed commits --- test/integration/auth/mongodb_oidc.prose.test.ts | 14 ++++++++++++++ test/tools/unified-spec-runner/entities.ts | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/test/integration/auth/mongodb_oidc.prose.test.ts b/test/integration/auth/mongodb_oidc.prose.test.ts index 66aabda7e84..9115b0248d8 100644 --- a/test/integration/auth/mongodb_oidc.prose.test.ts +++ b/test/integration/auth/mongodb_oidc.prose.test.ts @@ -318,6 +318,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -402,6 +403,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -457,6 +459,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -522,6 +525,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient?.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -587,6 +591,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient?.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -654,6 +659,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient?.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -733,6 +739,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1089,6 +1096,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1190,6 +1198,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1252,6 +1261,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1348,6 +1358,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1419,6 +1430,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1496,6 +1508,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' @@ -1581,6 +1594,7 @@ describe('OIDC Auth Spec Tests', function () { }); afterEach(async function () { + // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', mode: 'off' diff --git a/test/tools/unified-spec-runner/entities.ts b/test/tools/unified-spec-runner/entities.ts index 534071749a5..0edf984addb 100644 --- a/test/tools/unified-spec-runner/entities.ts +++ b/test/tools/unified-spec-runner/entities.ts @@ -265,6 +265,17 @@ export class UnifiedMongoClient extends MongoClient { }; } + // Test descriptions use `appName` and `appname` interchangeably + if ( + description.uriOptions && + (description.uriOptions.appName != null || description.uriOptions.appname != null) + ) { + options.appName = description.uriOptions.appName ?? description.uriOptions.appname; + } else { + const appNameNonce = new Date().getTime().toString(); + options.appName = `unified-spec-runner-${appNameNonce}`; + } + super(uri, options); this.observedEventEmitter.on('error', () => null); this.logCollector = logCollector; From f5c5846265b79524ce9b8cb52b78187ef9e04d1b Mon Sep 17 00:00:00 2001 From: Pavel Safronov Date: Fri, 20 Feb 2026 14:22:00 -0800 Subject: [PATCH 3/3] pr feedback: - configured a distinct per-test appName - removed generated appName --- .../auth/mongodb_oidc.prose.test.ts | 172 ++++++++++++------ test/tools/unified-spec-runner/entities.ts | 11 -- 2 files changed, 117 insertions(+), 66 deletions(-) diff --git a/test/integration/auth/mongodb_oidc.prose.test.ts b/test/integration/auth/mongodb_oidc.prose.test.ts index 9115b0248d8..0ebc9bf2121 100644 --- a/test/integration/auth/mongodb_oidc.prose.test.ts +++ b/test/integration/auth/mongodb_oidc.prose.test.ts @@ -39,6 +39,11 @@ const generateResult = (token: string, expiresInSeconds?: number, extraFields?: return response; }; +let appNameCounter = 0; +const createAppName = (extra?: string) => { + return `oidc-${appNameCounter++}-app${extra ? `-${extra}` : ''}`; +}; + const DEFAULT_URI = 'mongodb://127.0.0.1:27017'; const URI_SINGLE = process.env.MONGODB_URI_SINGLE ?? DEFAULT_URI; const isCallbackTest = process.env.ENVIRONMENT === 'test'; @@ -278,6 +283,7 @@ describe('OIDC Auth Spec Tests', function () { describe('3.3 Unexpected error code does not clear the cache', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create a MongoClient with a callback that returns a valid token. // Set a fail point for saslStart commands of the form: @@ -299,8 +305,8 @@ describe('OIDC Auth Spec Tests', function () { // `[callback-only]` Assert that the callback has been called once. // Close the client. beforeEach(async function () { - client = getClient({}, callbackSpy); - utilClient = getClient({}, createCallback()); + client = getClient({ appName }, callbackSpy); + utilClient = getClient({ appName }, createCallback()); collection = client.db('test').collection('test'); await utilClient .db() @@ -312,7 +318,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['saslStart'], - errorCode: 20 + errorCode: 20, + appName } }); }); @@ -321,7 +328,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -365,6 +373,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.1 Reauthentication Succeeds', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create an OIDC configured client. // Set a fail point for find commands of the form: @@ -384,8 +393,8 @@ describe('OIDC Auth Spec Tests', function () { // `[callback-only]` Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication). // Close the client. beforeEach(async function () { - client = getClient({}, callbackSpy); - utilClient = getClient({}, createCallback()); + client = getClient({ appName }, callbackSpy); + utilClient = getClient({ appName }, createCallback()); collection = client.db('test').collection('test'); await utilClient .db() @@ -406,7 +415,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -421,6 +431,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.1 Reauthentication Succeeds (promoteValues: false)', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create an OIDC configured client. // Set a fail point for find commands of the form: @@ -440,8 +451,8 @@ describe('OIDC Auth Spec Tests', function () { // `[callback-only]` Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication). // Close the client. beforeEach(async function () { - client = getClient({ promoteValues: false }, callbackSpy); - utilClient = getClient({ promoteValues: false }, createCallback()); + client = getClient({ promoteValues: false, appName }, callbackSpy); + utilClient = getClient({ promoteValues: false, appName }, createCallback()); collection = client.db('test').collection('test'); await utilClient .db() @@ -462,7 +473,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -477,6 +489,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.2 `[callback-only]` Read Commands Fail If Reauthentication Fails', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createBadCallback()); // Create a MongoClient whose OIDC callback returns one good token and then bad tokens after the first call. // Perform a find operation that succeeds. @@ -501,12 +514,13 @@ describe('OIDC Auth Spec Tests', function () { this.test.skipReason = 'Callback validation tests only run in test environment'; this.test.skip(); } - client = getClient({}, callbackSpy); + client = getClient({ appName }, callbackSpy); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('test'); await utilClient @@ -519,7 +533,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -528,7 +543,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient?.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient?.close(); }); @@ -542,6 +558,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.3 `[callback-only]` Write Commands Fail If Reauthentication Fails', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createBadCallback()); // Create a MongoClient whose OIDC callback returns one good token and then bad tokens after the first call. // Perform an insert operation that succeeds. @@ -566,12 +583,13 @@ describe('OIDC Auth Spec Tests', function () { this.test.skipReason = 'Callback validation tests only run in test environment'; this.test.skip(); } - client = getClient({}, callbackSpy); + client = getClient({ appName }, callbackSpy); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('test'); await collection.insertOne({ n: 1 }); @@ -585,7 +603,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['insert'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -594,7 +613,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient?.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient?.close(); }); @@ -608,6 +628,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.4 Speculative Authentication should be ignored on Reauthentication', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); const saslStarts = []; // - Create an OIDC configured client. @@ -636,8 +657,8 @@ describe('OIDC Auth Spec Tests', function () { // - Assert there were `SaslStart` commands executed. // - Close the client. beforeEach(async function () { - utilClient = getClient({}, createCallback()); - client = getClient({ monitorCommands: true }, callbackSpy); + utilClient = getClient({ appName }, createCallback()); + client = getClient({ monitorCommands: true, appName }, callbackSpy); client.on('commandStarted', event => { if (event.commandName === 'saslStart') { saslStarts.push(event); @@ -662,7 +683,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient?.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient?.close(); }); @@ -684,7 +706,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['insert'], - errorCode: 391 + errorCode: 391, + appName } }); @@ -699,6 +722,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.5 Reauthentication Succeeds when a Session is involved', function () { let utilClient: MongoClient; let session: ClientSession; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create an OIDC configured client. // Set a fail point for find commands of the form: @@ -719,8 +743,8 @@ describe('OIDC Auth Spec Tests', function () { // `[callback-only]` Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication). // Close the session and the client. beforeEach(async function () { - client = getClient({}, callbackSpy); - utilClient = getClient({}, createCallback()); + client = getClient({ appName }, callbackSpy); + utilClient = getClient({ appName }, createCallback()); collection = client.db('test').collection('test'); await utilClient .db() @@ -732,7 +756,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); session = client.startSession(); @@ -742,7 +767,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); await session.endSession(); @@ -1046,6 +1072,7 @@ describe('OIDC Auth Spec Tests', function () { describe('2.3 Refresh Token Is Passed To The Callback', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create a MongoClient with a human callback that checks for the presence of a refresh token. // Perform a find operation that succeeds. @@ -1070,13 +1097,15 @@ describe('OIDC Auth Spec Tests', function () { authMechanismProperties: { OIDC_HUMAN_CALLBACK: callbackSpy }, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await collection.findOne(); @@ -1090,7 +1119,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -1099,7 +1129,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -1122,6 +1153,7 @@ describe('OIDC Auth Spec Tests', function () { describe('3.1 Uses speculative authentication if there is a cached token', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create an OIDC configured client with a human callback that returns a valid token. // Set a fail point for find commands of the form: @@ -1158,13 +1190,15 @@ describe('OIDC Auth Spec Tests', function () { authMechanismProperties: { OIDC_HUMAN_CALLBACK: callbackSpy }, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await utilClient @@ -1177,7 +1211,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - closeConnection: true + closeConnection: true, + appName } }); const error = await collection.findOne().catch(error => error); @@ -1192,7 +1227,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['saslStart'], - errorCode: 18 + errorCode: 18, + appName } }); }); @@ -1201,7 +1237,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -1214,6 +1251,7 @@ describe('OIDC Auth Spec Tests', function () { describe('3.2 Does not use speculative authentication if there is no cached token', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create an OIDC configured client with a human callback that returns a valid token. // Set a fail point for saslStart commands of the form: @@ -1236,13 +1274,15 @@ describe('OIDC Auth Spec Tests', function () { authMechanismProperties: { OIDC_HUMAN_CALLBACK: callbackSpy }, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await utilClient @@ -1255,7 +1295,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['saslStart'], - errorCode: 18 + errorCode: 18, + appName } }); }); @@ -1264,7 +1305,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -1286,6 +1328,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.1 Succeeds', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); const commandStartedEvents = []; const commandSucceededEvents = []; @@ -1322,13 +1365,15 @@ describe('OIDC Auth Spec Tests', function () { OIDC_HUMAN_CALLBACK: callbackSpy }, monitorCommands: true, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await collection.findOne(); @@ -1352,7 +1397,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -1361,7 +1407,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -1377,6 +1424,7 @@ describe('OIDC Auth Spec Tests', function () { describe('4.2 Succeeds no refresh', function () { let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createCallback()); // Create an OIDC configured client with a human callback that does not return a refresh token. // Perform a find operation that succeeds. @@ -1403,13 +1451,15 @@ describe('OIDC Auth Spec Tests', function () { OIDC_HUMAN_CALLBACK: callbackSpy }, monitorCommands: true, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await collection.findOne(); @@ -1424,7 +1474,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -1433,7 +1484,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -1455,6 +1507,7 @@ describe('OIDC Auth Spec Tests', function () { }; let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createBadCallback()); // Create an OIDC configured client with a callback that returns the test_user1 access token and a bad refresh token. // Perform a find operation that succeeds. @@ -1481,13 +1534,15 @@ describe('OIDC Auth Spec Tests', function () { OIDC_HUMAN_CALLBACK: callbackSpy }, monitorCommands: true, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await collection.findOne(); @@ -1502,7 +1557,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -1511,7 +1567,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); @@ -1541,6 +1598,7 @@ describe('OIDC Auth Spec Tests', function () { }; let utilClient: MongoClient; + const appName = createAppName(); const callbackSpy = sinon.spy(createBadCallback()); // Create an OIDC configured client that returns invalid refresh tokens and returns invalid access tokens after the first access. // Perform a find operation that succeeds. @@ -1567,13 +1625,15 @@ describe('OIDC Auth Spec Tests', function () { OIDC_HUMAN_CALLBACK: callbackSpy }, monitorCommands: true, - retryReads: false + retryReads: false, + appName }); utilClient = new MongoClient(uriSingle, { authMechanismProperties: { OIDC_HUMAN_CALLBACK: createCallback() }, - retryReads: false + retryReads: false, + appName }); collection = client.db('test').collection('testHuman'); await collection.findOne(); @@ -1588,7 +1648,8 @@ describe('OIDC Auth Spec Tests', function () { }, data: { failCommands: ['find'], - errorCode: 391 + errorCode: 391, + appName } }); }); @@ -1597,7 +1658,8 @@ describe('OIDC Auth Spec Tests', function () { // explicitly remove the fail point to prevent interaction betweet test runs await utilClient.db().admin().command({ configureFailPoint: 'failCommand', - mode: 'off' + mode: 'off', + data: { appName } }); await utilClient.close(); }); diff --git a/test/tools/unified-spec-runner/entities.ts b/test/tools/unified-spec-runner/entities.ts index 0edf984addb..534071749a5 100644 --- a/test/tools/unified-spec-runner/entities.ts +++ b/test/tools/unified-spec-runner/entities.ts @@ -265,17 +265,6 @@ export class UnifiedMongoClient extends MongoClient { }; } - // Test descriptions use `appName` and `appname` interchangeably - if ( - description.uriOptions && - (description.uriOptions.appName != null || description.uriOptions.appname != null) - ) { - options.appName = description.uriOptions.appName ?? description.uriOptions.appname; - } else { - const appNameNonce = new Date().getTime().toString(); - options.appName = `unified-spec-runner-${appNameNonce}`; - } - super(uri, options); this.observedEventEmitter.on('error', () => null); this.logCollector = logCollector;