Skip to content

Commit 47ceebc

Browse files
committed
fix(core): update the failing test cases
1 parent 501bd9b commit 47ceebc

4 files changed

Lines changed: 2 additions & 25 deletions

File tree

packages/core/src/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ export const resolveAwsSdkSigV4Config = <T>(
146146
const creds = await boundProvider(options);
147147
const attributedCreds = creds as AttributedAwsCredentialIdentity;
148148

149-
// Only set CREDENTIALS_CODE if user provided a credential object
150-
if (isCredentialObject) {
149+
// Only set CREDENTIALS_CODE if user provided a credential object and no source attribution exists
150+
if (isCredentialObject && (!attributedCreds.$source || Object.keys(attributedCreds.$source).length === 0)) {
151151
return setCredentialFeature(attributedCreds, "CREDENTIALS_CODE", "e");
152152
}
153153
return attributedCreds;

packages/credential-provider-node/tests/credential-provider-node.integ.spec.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,6 @@ describe("credential-provider-node integration test", () => {
820820
sessionToken: "COGNITO_SESSION_TOKEN_ap-northeast-1",
821821
identityId: "",
822822
expiration: new Date("3000-01-01T00:00:00.000Z"),
823-
$source: { CREDENTIALS_CODE: "e" },
824823
});
825824
});
826825

@@ -839,7 +838,6 @@ describe("credential-provider-node integration test", () => {
839838
sessionToken: "COGNITO_SESSION_TOKEN_ap-northeast-1",
840839
identityId: "ap-northeast-1:COGNITO_IDENTITY_ID",
841840
expiration: new Date("3000-01-01T00:00:00.000Z"),
842-
$source: { CREDENTIALS_CODE: "e" },
843841
});
844842
});
845843

@@ -1293,9 +1291,6 @@ describe("credential-provider-node integration test", () => {
12931291
expect(credentials).toEqual({
12941292
accessKeyId: "STS_AK1",
12951293
secretAccessKey: "STS_SAK1",
1296-
$source: {
1297-
CREDENTIALS_CODE: "e",
1298-
},
12991294
});
13001295
});
13011296

@@ -1308,18 +1303,12 @@ describe("credential-provider-node integration test", () => {
13081303
expect(credentials1).toEqual({
13091304
accessKeyId: "STS_AK1",
13101305
secretAccessKey: "STS_SAK1",
1311-
$source: {
1312-
CREDENTIALS_CODE: "e",
1313-
},
13141306
});
13151307

13161308
const credentials2 = await client.config.credentials({});
13171309
expect(credentials2).toEqual({
13181310
accessKeyId: "STS_AK1",
13191311
secretAccessKey: "STS_SAK1",
1320-
$source: {
1321-
CREDENTIALS_CODE: "e",
1322-
},
13231312
});
13241313

13251314
const credentials3 = await client.config.credentials({
@@ -1328,18 +1317,12 @@ describe("credential-provider-node integration test", () => {
13281317
expect(credentials3).toEqual({
13291318
accessKeyId: "STS_AK2",
13301319
secretAccessKey: "STS_SAK2",
1331-
$source: {
1332-
CREDENTIALS_CODE: "e",
1333-
},
13341320
});
13351321

13361322
const credentials4 = await client.config.credentials({});
13371323
expect(credentials4).toEqual({
13381324
accessKeyId: "STS_AK2",
13391325
secretAccessKey: "STS_SAK2",
1340-
$source: {
1341-
CREDENTIALS_CODE: "e",
1342-
},
13431326
});
13441327
});
13451328
});

packages/credential-providers/tests/fromCognitoIdentity.integ.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ describe(fromCognitoIdentity.name, () => {
4141
});
4242
await s3.listBuckets();
4343
expect(await s3.config.credentials()).toEqual({
44-
$source: {
45-
CREDENTIALS_CODE: "e",
46-
},
4744
accessKeyId: "COGNITO_ACCESS_KEY_ID",
4845
expiration: new Date("3000-01-01T00:00:00.000Z"),
4946
identityId: "us-east-2:128d0a74-c82f-4553-916d-90053example",

packages/credential-providers/tests/fromCognitoIdentityPool.integ.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ describe(fromCognitoIdentityPool.name, () => {
4141
});
4242
await s3.listBuckets();
4343
expect(await s3.config.credentials()).toEqual({
44-
$source: {
45-
CREDENTIALS_CODE: "e",
46-
},
4744
accessKeyId: "COGNITO_ACCESS_KEY_ID",
4845
expiration: new Date("3000-01-01T00:00:00.000Z"),
4946
identityId: "us-east-2:COGNITO_IDENTITY_ID",

0 commit comments

Comments
 (0)