Skip to content

Commit 0ca8943

Browse files
committed
add back test isolation
1 parent 10051bc commit 0ca8943

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

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

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

511-
it('does not cache if the credentials file changes', async function () {
512-
const initialCreds = {
513-
profileName: 'default',
514-
accessKey: 'x',
515-
secretKey: 'x',
516-
}
517-
518-
await UserCredentialsUtils.generateCredentialsFile(initialCreds)
519-
520-
const conn = await auth.getConnection({ id: 'profile:default' })
521-
assert.ok(conn?.type === 'iam', 'Expected an IAM connection')
522-
assert.deepStrictEqual(await conn.getCredentials(), {
523-
accessKeyId: initialCreds.accessKey,
524-
secretAccessKey: initialCreds.secretKey,
525-
sessionToken: undefined,
526-
})
511+
for (const _ of Array.from({ length: 1000 }, (i) => i)) {
512+
it('does not cache if the credentials file changes', async function () {
513+
const initialCreds = {
514+
profileName: 'default',
515+
accessKey: 'x',
516+
secretKey: 'x',
517+
}
518+
519+
await UserCredentialsUtils.generateCredentialsFile(initialCreds)
520+
521+
const conn = await auth.getConnection({ id: 'profile:default' })
522+
assert.ok(conn?.type === 'iam', 'Expected an IAM connection')
523+
assert.deepStrictEqual(await conn.getCredentials(), {
524+
accessKeyId: initialCreds.accessKey,
525+
secretAccessKey: initialCreds.secretKey,
526+
sessionToken: undefined,
527+
})
527528

528-
await fs.delete(getCredentialsFilename())
529+
await fs.delete(getCredentialsFilename())
529530

530-
const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
531-
await UserCredentialsUtils.generateCredentialsFile(newCreds)
531+
const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
532+
await UserCredentialsUtils.generateCredentialsFile(newCreds)
532533

533-
const credsAreUpdated = (creds: Credentials) => {
534-
return creds.accessKeyId === newCreds.accessKey && creds.secretAccessKey === newCreds.secretKey
535-
}
534+
const credsAreUpdated = (creds: Credentials) => {
535+
return creds.accessKeyId === newCreds.accessKey && creds.secretAccessKey === newCreds.secretKey
536+
}
536537

537-
const credsUpdated = await waitUntil(async () => credsAreUpdated(await conn.getCredentials()), {
538-
timeout: 5000,
539-
truthy: true,
538+
const credsUpdated = await waitUntil(async () => credsAreUpdated(await conn.getCredentials()), {
539+
timeout: 5000,
540+
interval: 100,
541+
truthy: true,
542+
})
543+
assert.ok(credsUpdated, 'Expected credentials to be updated')
540544
})
541-
assert.ok(credsUpdated, 'Expected credentials to be updated')
542-
})
545+
}
543546
})
544547

545548
describe('AuthNode', function () {

0 commit comments

Comments
 (0)