Skip to content

Commit 9291ebb

Browse files
committed
add check for mtime
1 parent 0ca8943 commit 9291ebb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/test/credentials/auth.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ describe('Auth', function () {
508508
await fs.delete(tmpDir, { recursive: true })
509509
})
510510

511-
for (const _ of Array.from({ length: 1000 }, (i) => i)) {
511+
for (const _ of Array.from({ length: 100 }, (i) => i)) {
512512
it('does not cache if the credentials file changes', async function () {
513513
const initialCreds = {
514514
profileName: 'default',
@@ -525,16 +525,18 @@ describe('Auth', function () {
525525
secretAccessKey: initialCreds.secretKey,
526526
sessionToken: undefined,
527527
})
528+
const lastModifiedBefore = (await fs.stat(getCredentialsFilename())).mtime
528529

529530
await fs.delete(getCredentialsFilename())
530531

531532
const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
532533
await UserCredentialsUtils.generateCredentialsFile(newCreds)
533-
534+
const lastModifiedAfter = (await fs.stat(getCredentialsFilename())).mtime
534535
const credsAreUpdated = (creds: Credentials) => {
535536
return creds.accessKeyId === newCreds.accessKey && creds.secretAccessKey === newCreds.secretKey
536537
}
537-
538+
console.log(lastModifiedBefore, lastModifiedAfter)
539+
assert.notStrictEqual(lastModifiedBefore, lastModifiedAfter, 'Expected credentials file to be updated')
538540
const credsUpdated = await waitUntil(async () => credsAreUpdated(await conn.getCredentials()), {
539541
timeout: 5000,
540542
interval: 100,

0 commit comments

Comments
 (0)