Skip to content

Commit c284254

Browse files
committed
adjust logging and timeout
1 parent 8c31442 commit c284254

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/core/src/auth/providers/sharedCredentialsProviderFactory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class SharedCredentialsProviderFactory extends BaseCredentialsProviderFac
3535
}
3636

3737
private async needsRefresh(): Promise<boolean> {
38+
console.log('needs refreshCalled')
3839
const credentialsLastModMillis = await this.getLastModifiedMillis(getCredentialsFilename())
3940
const configLastModMillis = await this.getLastModifiedMillis(getConfigFilename())
4041

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

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

511-
for (const _ of Array.from({ length: 100 }, (i) => i)) {
512-
it('does not cache if the credentials file changes', async function () {
511+
for (const _ of Array.from({ length: 1 }, (i) => i)) {
512+
it.only('does not cache if the credentials file changes', async function () {
513513
const initialCreds = {
514514
profileName: 'default',
515515
accessKey: 'x',
@@ -525,20 +525,22 @@ describe('Auth', function () {
525525
secretAccessKey: initialCreds.secretKey,
526526
sessionToken: undefined,
527527
})
528-
const lastModifiedBefore = (await fs.stat(getCredentialsFilename())).mtime
528+
const statBefore = await fs.stat(getCredentialsFilename())
529529

530530
await fs.delete(getCredentialsFilename())
531+
console.log('file deleted')
531532

532533
const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
533534
await UserCredentialsUtils.generateCredentialsFile(newCreds)
534-
const lastModifiedAfter = (await fs.stat(getCredentialsFilename())).mtime
535+
console.log('file written')
536+
const statAfter = await fs.stat(getCredentialsFilename())
535537
const credsAreUpdated = (creds: Credentials) => {
536538
return creds.accessKeyId === newCreds.accessKey && creds.secretAccessKey === newCreds.secretKey
537539
}
538-
console.log('before: %O, after: %O', lastModifiedBefore, lastModifiedAfter)
539-
assert.notStrictEqual(lastModifiedBefore, lastModifiedAfter, 'Expected credentials file to be updated')
540+
console.log('before: %O, after: %O', statBefore, statAfter)
541+
assert.notStrictEqual(statBefore, statAfter, 'Expected credentials file to be updated')
540542
const credsUpdated = await waitUntil(async () => credsAreUpdated(await conn.getCredentials()), {
541-
timeout: 5000,
543+
timeout: 1000,
542544
interval: 100,
543545
truthy: true,
544546
})

0 commit comments

Comments
 (0)