Skip to content

Commit 9b167ac

Browse files
committed
adjust logging, set timeout manually
1 parent a42f264 commit 9b167ac

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

packages/core/src/auth/auth.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -867,14 +867,14 @@ export class Auth implements AuthService, ConnectionManager {
867867
}
868868

869869
private async getCachedCredentials(provider: CredentialsProvider) {
870-
//eslint-disable-next-line aws-toolkits/no-console-log
871-
console.log('getCachedCredentials called')
872870
const creds = await globals.loginManager.store.getCredentials(provider.getCredentialsId())
873871
//eslint-disable-next-line aws-toolkits/no-console-log
874872
console.log(
875873
'provider hash is same as credentials has: %O',
876874
creds?.credentialsHashCode === provider.getHashCode()
877875
)
876+
//eslint-disable-next-line aws-toolkits/no-console-log
877+
console.log('creds is undefined: %O', creds === undefined)
878878
if (creds !== undefined && creds.credentialsHashCode === provider.getHashCode()) {
879879
//eslint-disable-next-line aws-toolkits/no-console-log
880880
console.log('returning cached credentials')
@@ -885,8 +885,6 @@ export class Auth implements AuthService, ConnectionManager {
885885
private readonly getToken = keyedDebounce(this._getToken.bind(this))
886886
@withTelemetryContext({ name: '_getToken', class: authClassName })
887887
private async _getToken(id: Connection['id'], provider: SsoAccessTokenProvider): Promise<SsoToken> {
888-
//eslint-disable-next-line aws-toolkits/no-console-log
889-
console.log('_getToken called')
890888
const token = await provider.getToken().catch((err) => {
891889
this.throwOnRecoverableError(err)
892890

@@ -922,20 +920,18 @@ export class Auth implements AuthService, ConnectionManager {
922920

923921
private readonly getCredentials = keyedDebounce(this._getCredentials.bind(this))
924922
private async _getCredentials(id: Connection['id'], provider: CredentialsProvider): Promise<Credentials> {
925-
//eslint-disable-next-line aws-toolkits/no-console-log
926-
console.log('_getCredentials called')
927923
const credentials = await this.getCachedCredentials(provider)
928924
//eslint-disable-next-line aws-toolkits/no-console-log
929925
console.log('credentials is undefined: %O', credentials === undefined)
930926
if (credentials !== undefined) {
931927
//eslint-disable-next-line aws-toolkits/no-console-log
932-
console.log('returning cached credentials')
928+
console.log('hit sad path (cache passed)')
933929
return credentials
934930
} else if ((await provider.canAutoConnect()) === true) {
935931
return this.createCachedCredentials(provider)
936932
} else {
937933
//eslint-disable-next-line aws-toolkits/no-console-log
938-
console.log('hit case with handleInvalidCredentials')
934+
console.log('hit happy path (cache failed)')
939935
return this.handleInvalidCredentials(id, () => this.createCachedCredentials(provider))
940936
}
941937
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export class CredentialsStore {
4242
* Returns undefined if the specified credentials are expired or not found.
4343
*/
4444
public async getCredentials(credentials: CredentialsId): Promise<CachedCredentials | undefined> {
45-
//eslint-disable-next-line aws-toolkits/no-console-log
46-
console.log('credentials.isValid=%O', this.isValid(asString(credentials)))
4745
if (this.isValid(asString(credentials))) {
4846
return this.credentialsCache[asString(credentials)]
4947
} else {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ export class SharedCredentialsProvider implements CredentialsProvider {
6767
public constructor(
6868
private readonly profileName: string,
6969
private readonly sections: Section[]
70-
) {}
70+
) {
71+
//eslint-disable-next-line aws-toolkits/no-console-log
72+
console.log('init new SharedCredentialsProvider')
73+
}
7174

7275
public getCredentialsId(): CredentialsId {
7376
return {
@@ -98,6 +101,8 @@ export class SharedCredentialsProvider implements CredentialsProvider {
98101
}
99102

100103
public getHashCode(): string {
104+
//eslint-disable-next-line aws-toolkits/no-console-log
105+
console.log('returning hash: %O', getStringHash(JSON.stringify(this.profile)))
101106
return getStringHash(JSON.stringify(this.profile))
102107
}
103108

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ describe('Auth', function () {
510510
it('does not cache if the credentials file changes', async function () {
511511
if (isWin()) {
512512
this.retries(5)
513+
this.timeout(30000)
513514
}
515+
514516
const initialCreds = {
515517
profileName: 'default',
516518
accessKey: 'x',

0 commit comments

Comments
 (0)