@@ -508,14 +508,14 @@ describe('Auth', function () {
508508 await fs . delete ( tmpDir , { recursive : true } )
509509 } )
510510
511- for ( const _ of Array . from ( { length : 100 } , ( i ) => i ) ) {
511+ for ( const _ of Array . from ( { length : 1000 } , ( i ) => i ) ) {
512512 it ( 'does not cache if the credentials file changes' , async function ( ) {
513513 const initialCreds = {
514514 profileName : 'default' ,
515515 accessKey : 'x' ,
516516 secretKey : 'x' ,
517517 }
518- console . log ( 'generating file for the first time' )
518+ console . log ( 'Generating credentials file for the first time' )
519519 await UserCredentialsUtils . generateCredentialsFile ( initialCreds )
520520
521521 const initialStats = await fs . stat ( getCredentialsFilename ( ) )
@@ -530,26 +530,20 @@ describe('Auth', function () {
530530 } )
531531 const contentBeforeDeleting = await fs . readFileText ( getCredentialsFilename ( ) )
532532 const statBeforeDeleting = await fs . stat ( getCredentialsFilename ( ) )
533- console . log ( 'Deleting the file' )
533+ console . log ( 'Deleting the credentials file' )
534534 await fs . delete ( getCredentialsFilename ( ) )
535535
536536 const newCreds = { ...initialCreds , accessKey : 'y' , secretKey : 'y' }
537- console . log ( 'regenerating the same file' )
537+ console . log ( 'Regenerating credentials file' )
538538 await UserCredentialsUtils . generateCredentialsFile ( newCreds )
539539
540540 const statsAfterRegen = await fs . stat ( getCredentialsFilename ( ) )
541541 const contentAfterRegen = await fs . readFileText ( getCredentialsFilename ( ) )
542542 const credsAreUpdated = ( creds : Credentials ) => {
543543 return creds . accessKeyId === newCreds . accessKey && creds . secretAccessKey === newCreds . secretKey
544544 }
545- console . log (
546- 'initial: %O, beforeDelete: %O, afterRegen: %O' ,
547- initialStats ,
548- statBeforeDeleting ,
549- statsAfterRegen
550- )
551545
552- console . log ( 'Before wait until ' )
546+ console . log ( 'Before waitUntil block ' )
553547 const start = Date . now ( )
554548 const credsUpdated = await waitUntil ( async ( ) => credsAreUpdated ( await conn . getCredentials ( ) ) , {
555549 timeout : 10000 ,
@@ -560,19 +554,23 @@ describe('Auth', function () {
560554 const statAfterWait = await fs . stat ( getCredentialsFilename ( ) )
561555 const contentAfterWait = await fs . readFileText ( getCredentialsFilename ( ) )
562556 console . log (
563- 'stats: initial: %O, beforeDelete: %O, afterRegen: %O, afterWait: %O' ,
557+ 'stats:\n -- initial: %O \n, -- beforeDelete: %O \n, -- afterRegen: %O \n, -- afterWait: %O \n ' ,
564558 initialStats ,
565559 statBeforeDeleting ,
566560 statsAfterRegen ,
567561 statAfterWait
568562 )
569563 console . log (
570- 'content: initial: %O, beforeDelete: %O, afterRegen: %O, afterWait: %O' ,
564+ 'content:\n -- initial: %O \n, -- beforeDelete: %O \n, -- afterRegen: %O \n, -- afterWait: %O \n ' ,
571565 intialContent ,
572566 contentBeforeDeleting ,
573567 contentAfterRegen ,
574568 contentAfterWait
575569 )
570+ if ( ! credsUpdated ) {
571+ console . log ( 'creds failed to update!' )
572+ console . log ( 'creds: %O' , await conn . getCredentials ( ) )
573+ }
576574 assert . ok ( credsUpdated , 'Expected credentials to be updated' )
577575 } )
578576 }
0 commit comments