@@ -283,7 +283,7 @@ describe('OIDC Auth Spec Tests', function () {
283283
284284 describe ( '3.3 Unexpected error code does not clear the cache' , function ( ) {
285285 let utilClient : MongoClient ;
286- const appName = createAppName ( ) ;
286+ let appName : string ;
287287 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
288288 // Create a MongoClient with a callback that returns a valid token.
289289 // Set a fail point for saslStart commands of the form:
@@ -305,6 +305,7 @@ describe('OIDC Auth Spec Tests', function () {
305305 // `[callback-only]` Assert that the callback has been called once.
306306 // Close the client.
307307 beforeEach ( async function ( ) {
308+ appName = createAppName ( ) ;
308309 client = getClient ( { appName } , callbackSpy ) ;
309310 utilClient = getClient ( { } , createCallback ( ) ) ;
310311 collection = client . db ( 'test' ) . collection ( 'test' ) ;
@@ -373,7 +374,7 @@ describe('OIDC Auth Spec Tests', function () {
373374
374375 describe ( '4.1 Reauthentication Succeeds' , function ( ) {
375376 let utilClient : MongoClient ;
376- const appName = createAppName ( ) ;
377+ let appName : string ;
377378 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
378379 // Create an OIDC configured client.
379380 // Set a fail point for find commands of the form:
@@ -393,6 +394,7 @@ describe('OIDC Auth Spec Tests', function () {
393394 // `[callback-only]` Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
394395 // Close the client.
395396 beforeEach ( async function ( ) {
397+ appName = createAppName ( ) ;
396398 client = getClient ( { appName } , callbackSpy ) ;
397399 utilClient = getClient ( { } , createCallback ( ) ) ;
398400 collection = client . db ( 'test' ) . collection ( 'test' ) ;
@@ -432,7 +434,7 @@ describe('OIDC Auth Spec Tests', function () {
432434
433435 describe ( '4.1 Reauthentication Succeeds (promoteValues: false)' , function ( ) {
434436 let utilClient : MongoClient ;
435- const appName = createAppName ( ) ;
437+ let appName : string ;
436438 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
437439 // Create an OIDC configured client.
438440 // Set a fail point for find commands of the form:
@@ -452,6 +454,7 @@ describe('OIDC Auth Spec Tests', function () {
452454 // `[callback-only]` Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
453455 // Close the client.
454456 beforeEach ( async function ( ) {
457+ appName = createAppName ( ) ;
455458 client = getClient ( { promoteValues : false , appName } , callbackSpy ) ;
456459 utilClient = getClient ( { promoteValues : false } , createCallback ( ) ) ;
457460 collection = client . db ( 'test' ) . collection ( 'test' ) ;
@@ -491,7 +494,7 @@ describe('OIDC Auth Spec Tests', function () {
491494
492495 describe ( '4.2 `[callback-only]` Read Commands Fail If Reauthentication Fails' , function ( ) {
493496 let utilClient : MongoClient ;
494- const appName = createAppName ( ) ;
497+ let appName : string ;
495498 const callbackSpy = sinon . spy ( createBadCallback ( ) ) ;
496499 // Create a MongoClient whose OIDC callback returns one good token and then bad tokens after the first call.
497500 // Perform a find operation that succeeds.
@@ -516,6 +519,7 @@ describe('OIDC Auth Spec Tests', function () {
516519 this . test . skipReason = 'Callback validation tests only run in test environment' ;
517520 this . test . skip ( ) ;
518521 }
522+ appName = createAppName ( ) ;
519523 client = getClient ( { appName } , callbackSpy ) ;
520524 utilClient = new MongoClient ( uriSingle , {
521525 authMechanismProperties : {
@@ -560,7 +564,7 @@ describe('OIDC Auth Spec Tests', function () {
560564
561565 describe ( '4.3 `[callback-only]` Write Commands Fail If Reauthentication Fails' , function ( ) {
562566 let utilClient : MongoClient ;
563- const appName = createAppName ( ) ;
567+ let appName : string ;
564568 const callbackSpy = sinon . spy ( createBadCallback ( ) ) ;
565569 // Create a MongoClient whose OIDC callback returns one good token and then bad tokens after the first call.
566570 // Perform an insert operation that succeeds.
@@ -585,6 +589,7 @@ describe('OIDC Auth Spec Tests', function () {
585589 this . test . skipReason = 'Callback validation tests only run in test environment' ;
586590 this . test . skip ( ) ;
587591 }
592+ appName = createAppName ( ) ;
588593 client = getClient ( { appName } , callbackSpy ) ;
589594 utilClient = new MongoClient ( uriSingle , {
590595 authMechanismProperties : {
@@ -630,7 +635,7 @@ describe('OIDC Auth Spec Tests', function () {
630635
631636 describe ( '4.4 Speculative Authentication should be ignored on Reauthentication' , function ( ) {
632637 let utilClient : MongoClient ;
633- const appName = createAppName ( ) ;
638+ let appName : string ;
634639 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
635640 const saslStarts = [ ] ;
636641 // - Create an OIDC configured client.
@@ -660,6 +665,7 @@ describe('OIDC Auth Spec Tests', function () {
660665 // - Close the client.
661666 beforeEach ( async function ( ) {
662667 utilClient = getClient ( { } , createCallback ( ) ) ;
668+ appName = createAppName ( ) ;
663669 client = getClient ( { monitorCommands : true , appName } , callbackSpy ) ;
664670 client . on ( 'commandStarted' , event => {
665671 if ( event . commandName === 'saslStart' ) {
@@ -724,7 +730,7 @@ describe('OIDC Auth Spec Tests', function () {
724730 describe ( '4.5 Reauthentication Succeeds when a Session is involved' , function ( ) {
725731 let utilClient : MongoClient ;
726732 let session : ClientSession ;
727- const appName = createAppName ( ) ;
733+ let appName : string ;
728734 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
729735 // Create an OIDC configured client.
730736 // Set a fail point for find commands of the form:
@@ -745,6 +751,7 @@ describe('OIDC Auth Spec Tests', function () {
745751 // `[callback-only]` Assert that the callback was called 2 times (once during the connection handshake, and again during reauthentication).
746752 // Close the session and the client.
747753 beforeEach ( async function ( ) {
754+ appName = createAppName ( ) ;
748755 client = getClient ( { appName } , callbackSpy ) ;
749756 utilClient = getClient ( { } , createCallback ( ) ) ;
750757 collection = client . db ( 'test' ) . collection ( 'test' ) ;
@@ -1074,7 +1081,7 @@ describe('OIDC Auth Spec Tests', function () {
10741081
10751082 describe ( '2.3 Refresh Token Is Passed To The Callback' , function ( ) {
10761083 let utilClient : MongoClient ;
1077- const appName = createAppName ( ) ;
1084+ let appName : string ;
10781085 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
10791086 // Create a MongoClient with a human callback that checks for the presence of a refresh token.
10801087 // Perform a find operation that succeeds.
@@ -1095,6 +1102,7 @@ describe('OIDC Auth Spec Tests', function () {
10951102 // Assert that the callback has been called twice.
10961103 // Assert that the refresh token was provided to the callback once.
10971104 beforeEach ( async function ( ) {
1105+ appName = createAppName ( ) ;
10981106 client = new MongoClient ( uriSingle , {
10991107 authMechanismProperties : {
11001108 OIDC_HUMAN_CALLBACK : callbackSpy
@@ -1155,7 +1163,7 @@ describe('OIDC Auth Spec Tests', function () {
11551163
11561164 describe ( '3.1 Uses speculative authentication if there is a cached token' , function ( ) {
11571165 let utilClient : MongoClient ;
1158- const appName = createAppName ( ) ;
1166+ let appName : string ;
11591167 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
11601168 // Create an OIDC configured client with a human callback that returns a valid token.
11611169 // Set a fail point for find commands of the form:
@@ -1188,6 +1196,7 @@ describe('OIDC Auth Spec Tests', function () {
11881196 // Perform a find operation that succeeds.
11891197 // Close the client.
11901198 beforeEach ( async function ( ) {
1199+ appName = createAppName ( ) ;
11911200 client = new MongoClient ( uriSingle , {
11921201 authMechanismProperties : {
11931202 OIDC_HUMAN_CALLBACK : callbackSpy
@@ -1253,7 +1262,7 @@ describe('OIDC Auth Spec Tests', function () {
12531262
12541263 describe ( '3.2 Does not use speculative authentication if there is no cached token' , function ( ) {
12551264 let utilClient : MongoClient ;
1256- const appName = createAppName ( ) ;
1265+ let appName : string ;
12571266 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
12581267 // Create an OIDC configured client with a human callback that returns a valid token.
12591268 // Set a fail point for saslStart commands of the form:
@@ -1272,6 +1281,7 @@ describe('OIDC Auth Spec Tests', function () {
12721281 // Perform a find operation that fails.
12731282 // Close the client.
12741283 beforeEach ( async function ( ) {
1284+ appName = createAppName ( ) ;
12751285 client = new MongoClient ( uriSingle , {
12761286 authMechanismProperties : {
12771287 OIDC_HUMAN_CALLBACK : callbackSpy
@@ -1329,7 +1339,7 @@ describe('OIDC Auth Spec Tests', function () {
13291339
13301340 describe ( '4.1 Succeeds' , function ( ) {
13311341 let utilClient : MongoClient ;
1332- const appName = createAppName ( ) ;
1342+ let appName : string ;
13331343 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
13341344 const commandStartedEvents = [ ] ;
13351345 const commandSucceededEvents = [ ] ;
@@ -1361,6 +1371,7 @@ describe('OIDC Auth Spec Tests', function () {
13611371 // Assert that a find operation failed once during the command execution.
13621372 // Close the client.
13631373 beforeEach ( async function ( ) {
1374+ appName = createAppName ( ) ;
13641375 client = new MongoClient ( uriSingle , {
13651376 authMechanismProperties : {
13661377 OIDC_HUMAN_CALLBACK : callbackSpy
@@ -1424,7 +1435,7 @@ describe('OIDC Auth Spec Tests', function () {
14241435
14251436 describe ( '4.2 Succeeds no refresh' , function ( ) {
14261437 let utilClient : MongoClient ;
1427- const appName = createAppName ( ) ;
1438+ let appName : string ;
14281439 const callbackSpy = sinon . spy ( createCallback ( ) ) ;
14291440 // Create an OIDC configured client with a human callback that does not return a refresh token.
14301441 // Perform a find operation that succeeds.
@@ -1446,6 +1457,7 @@ describe('OIDC Auth Spec Tests', function () {
14461457 // Assert that the human callback has been called twice.
14471458 // Close the client.
14481459 beforeEach ( async function ( ) {
1460+ appName = createAppName ( ) ;
14491461 client = new MongoClient ( uriSingle , {
14501462 authMechanismProperties : {
14511463 OIDC_HUMAN_CALLBACK : callbackSpy
@@ -1506,7 +1518,7 @@ describe('OIDC Auth Spec Tests', function () {
15061518 } ;
15071519
15081520 let utilClient : MongoClient ;
1509- const appName = createAppName ( ) ;
1521+ let appName : string ;
15101522 const callbackSpy = sinon . spy ( createBadCallback ( ) ) ;
15111523 // Create an OIDC configured client with a callback that returns the test_user1 access token and a bad refresh token.
15121524 // Perform a find operation that succeeds.
@@ -1528,6 +1540,7 @@ describe('OIDC Auth Spec Tests', function () {
15281540 // Assert that the human callback has been called 2 times.
15291541 // Close the client.
15301542 beforeEach ( async function ( ) {
1543+ appName = createAppName ( ) ;
15311544 client = new MongoClient ( uriSingle , {
15321545 authMechanismProperties : {
15331546 OIDC_HUMAN_CALLBACK : callbackSpy
@@ -1596,7 +1609,7 @@ describe('OIDC Auth Spec Tests', function () {
15961609 } ;
15971610
15981611 let utilClient : MongoClient ;
1599- const appName = createAppName ( ) ;
1612+ let appName : string ;
16001613 const callbackSpy = sinon . spy ( createBadCallback ( ) ) ;
16011614 // Create an OIDC configured client that returns invalid refresh tokens and returns invalid access tokens after the first access.
16021615 // Perform a find operation that succeeds.
@@ -1618,6 +1631,7 @@ describe('OIDC Auth Spec Tests', function () {
16181631 // Assert that the human callback has been called three times.
16191632 // Close the client.
16201633 beforeEach ( async function ( ) {
1634+ appName = createAppName ( ) ;
16211635 client = new MongoClient ( uriSingle , {
16221636 authMechanismProperties : {
16231637 OIDC_HUMAN_CALLBACK : callbackSpy
0 commit comments