Skip to content

Commit

Permalink
reformat logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Nov 15, 2024
1 parent 9dff77c commit d7499fd
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/core/src/test/credentials/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ describe('Auth', function () {
await fs.delete(tmpDir, { recursive: true })
})

for (const _ of Array.from({ length: 100 }, (i) => i)) {
for (const _ of Array.from({ length: 1000 }, (i) => i)) {
it('does not cache if the credentials file changes', async function () {
const initialCreds = {
profileName: 'default',
accessKey: 'x',
secretKey: 'x',
}
console.log('generating file for the first time')
console.log('Generating credentials file for the first time')
await UserCredentialsUtils.generateCredentialsFile(initialCreds)

const initialStats = await fs.stat(getCredentialsFilename())
Expand All @@ -530,26 +530,20 @@ describe('Auth', function () {
})
const contentBeforeDeleting = await fs.readFileText(getCredentialsFilename())
const statBeforeDeleting = await fs.stat(getCredentialsFilename())
console.log('Deleting the file')
console.log('Deleting the credentials file')
await fs.delete(getCredentialsFilename())

const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' }
console.log('regenerating the same file')
console.log('Regenerating credentials file')
await UserCredentialsUtils.generateCredentialsFile(newCreds)

const statsAfterRegen = await fs.stat(getCredentialsFilename())
const contentAfterRegen = await fs.readFileText(getCredentialsFilename())
const credsAreUpdated = (creds: Credentials) => {
return creds.accessKeyId === newCreds.accessKey && creds.secretAccessKey === newCreds.secretKey
}
console.log(
'initial: %O, beforeDelete: %O, afterRegen: %O',
initialStats,
statBeforeDeleting,
statsAfterRegen
)

console.log('Before wait until')
console.log('Before waitUntil block')
const start = Date.now()
const credsUpdated = await waitUntil(async () => credsAreUpdated(await conn.getCredentials()), {
timeout: 10000,
Expand All @@ -560,19 +554,23 @@ describe('Auth', function () {
const statAfterWait = await fs.stat(getCredentialsFilename())
const contentAfterWait = await fs.readFileText(getCredentialsFilename())
console.log(
'stats: initial: %O, beforeDelete: %O, afterRegen: %O, afterWait: %O',
'stats:\n --initial: %O \n, --beforeDelete: %O \n, --afterRegen: %O \n, --afterWait: %O \n',
initialStats,
statBeforeDeleting,
statsAfterRegen,
statAfterWait
)
console.log(
'content: initial: %O, beforeDelete: %O, afterRegen: %O, afterWait: %O',
'content:\n --initial: %O \n, --beforeDelete: %O \n, --afterRegen: %O \n, --afterWait: %O \n',
intialContent,
contentBeforeDeleting,
contentAfterRegen,
contentAfterWait
)
if (!credsUpdated) {
console.log('creds failed to update!')
console.log('creds: %O', await conn.getCredentials())
}
assert.ok(credsUpdated, 'Expected credentials to be updated')
})
}
Expand Down

0 comments on commit d7499fd

Please sign in to comment.