From f2c17b8e78352e164713dc2b0dff778dcdb88a08 Mon Sep 17 00:00:00 2001 From: hkobew Date: Tue, 12 Nov 2024 12:34:13 -0500 Subject: [PATCH] check if cache is being returned --- packages/core/src/auth/auth.ts | 2 ++ .../core/src/shared/credentials/userCredentialsUtils.ts | 6 ------ packages/core/src/test/credentials/auth.test.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/core/src/auth/auth.ts b/packages/core/src/auth/auth.ts index d7c2a5d58b7..a973ea96277 100644 --- a/packages/core/src/auth/auth.ts +++ b/packages/core/src/auth/auth.ts @@ -903,6 +903,8 @@ export class Auth implements AuthService, ConnectionManager { private async _getCredentials(id: Connection['id'], provider: CredentialsProvider): Promise { const credentials = await this.getCachedCredentials(provider) if (credentials !== undefined) { + //eslint-disable-next-line aws-toolkits/no-console-log + console.log('returning cached credentials') return credentials } else if ((await provider.canAutoConnect()) === true) { return this.createCachedCredentials(provider) diff --git a/packages/core/src/shared/credentials/userCredentialsUtils.ts b/packages/core/src/shared/credentials/userCredentialsUtils.ts index 84ac3951ef8..3d6e0948568 100644 --- a/packages/core/src/shared/credentials/userCredentialsUtils.ts +++ b/packages/core/src/shared/credentials/userCredentialsUtils.ts @@ -92,16 +92,10 @@ export class UserCredentialsUtils { const contents = credentialsContext ? ['', createNewCredentialsFile(credentialsContext)] : [] if (await fs.exists(dest)) { - //eslint-disable-next-line aws-toolkits/no-console-log - console.log('hit case where dest exists') contents.unshift(await fs.readFileText(dest)) } else { - //eslint-disable-next-line aws-toolkits/no-console-log - console.log('hit case where dest exists') contents.unshift(header) } - //eslint-disable-next-line aws-toolkits/no-console-log - console.log('contents=%O', contents) await fs.writeFile(dest, contents.join('\n')) } } diff --git a/packages/core/src/test/credentials/auth.test.ts b/packages/core/src/test/credentials/auth.test.ts index 18594b966ff..60bb74acc16 100644 --- a/packages/core/src/test/credentials/auth.test.ts +++ b/packages/core/src/test/credentials/auth.test.ts @@ -528,7 +528,7 @@ describe('Auth', function () { const newCreds = { ...initialCreds, accessKey: 'y', secretKey: 'y' } await UserCredentialsUtils.generateCredentialsFile(newCreds) console.log('file exists after generating=%O', await fs.exists(getCredentialsFilename())) - console.log('file contents = %O', await fs.readFileText(getCredentialsFilename())) + assert.deepStrictEqual(await conn.getCredentials(), { accessKeyId: newCreds.accessKey, secretAccessKey: newCreds.secretKey,