Skip to content

Commit a42f264

Browse files
committed
implement a retry mechanism
1 parent e0eae0c commit a42f264

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { UserCredentialsUtils } from '../../shared/credentials/userCredentialsUt
1919
import { getCredentialsFilename } from '../../auth/credentials/sharedCredentialsFile'
2020
import { Connection, isIamConnection, isSsoConnection, scopesSsoAccountAccess } from '../../auth/connection'
2121
import { AuthNode, createDeleteConnectionButton, promptForConnection } from '../../auth/utils'
22-
import { waitUntil } from '../../shared'
22+
import { isWin } from '../../shared/vscode/env'
2323

2424
const ssoProfile = createSsoProfile()
2525
const scopedSsoProfile = createSsoProfile({ scopes: ['foo'] })
@@ -508,6 +508,9 @@ describe('Auth', function () {
508508
})
509509
for (const _ of Array.from({ length: 1000 }, (i) => i)) {
510510
it('does not cache if the credentials file changes', async function () {
511+
if (isWin()) {
512+
this.retries(5)
513+
}
511514
const initialCreds = {
512515
profileName: 'default',
513516
accessKey: 'x',
@@ -527,15 +530,9 @@ describe('Auth', function () {
527530
await fs.delete(getCredentialsFilename())
528531
const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
529532
await UserCredentialsUtils.generateCredentialsFile(newCreds)
530-
const didUpdate = await waitUntil(
531-
async () => (await fs.readFileText(getCredentialsFilename())) !== contentBefore,
532-
{
533-
timeout: 5000,
534-
truthy: true,
535-
}
536-
)
533+
const contentAfter = await fs.readFileText(getCredentialsFilename())
537534

538-
assert.ok(didUpdate, 'Expected the credentials file to be updated')
535+
assert.ok(contentBefore !== contentAfter)
539536

540537
assert.deepStrictEqual(await conn.getCredentials(), {
541538
accessKeyId: newCreds.accessKey,

0 commit comments

Comments
 (0)