Skip to content

Commit 0cb2dd7

Browse files
authored
test(credential-provider-node): check sso region in integ test (#5791)
1 parent 0bc9f48 commit 0cb2dd7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

+9-7
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ jest.mock("@aws-sdk/client-sso", () => {
5252
return {
5353
...actual,
5454
SSOClient: class {
55+
public constructor(public config: any) {}
5556
async send() {
5657
return {
5758
roleCredentials: {
5859
accessKeyId: "SSO_ACCESS_KEY_ID",
5960
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
6061
sessionToken: "SSO_SESSION_TOKEN",
6162
expiration: new Date("3000-01-01T00:00:00.000Z"),
62-
credentialScope: "us-sso-1",
63+
credentialScope: "us-sso-1-" + this.config.region,
6364
},
6465
};
6566
}
@@ -285,11 +286,12 @@ describe("credential-provider-node integration test", () => {
285286
describe("fromSSO", () => {
286287
it("should resolve SSO credentials if legacy SSO parameters are supplied directly", async () => {
287288
sts = new STS({
288-
region: "us-sso-1",
289+
// this is lower priority than the ssoRegion.
290+
region: "us-sso-region-2",
289291
credentials: defaultProvider({
290292
ssoStartUrl: "SSO_START_URL",
291293
ssoAccountId: "1234",
292-
ssoRegion: "us-sso-1",
294+
ssoRegion: "us-sso-region-1",
293295
ssoRoleName: "sso-role",
294296
}),
295297
requestHandler: mockRequestHandler,
@@ -301,7 +303,7 @@ describe("credential-provider-node integration test", () => {
301303
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
302304
sessionToken: "SSO_SESSION_TOKEN",
303305
expiration: new Date("3000-01-01T00:00:00.000Z"),
304-
credentialScope: "us-sso-1",
306+
credentialScope: "us-sso-1-us-sso-region-1",
305307
});
306308
});
307309
});
@@ -429,12 +431,12 @@ describe("credential-provider-node integration test", () => {
429431

430432
it("should resolve SSO credentials if the profile is an SSO profile", async () => {
431433
iniProfileData["sso-session.ssoNew"] = {
432-
sso_region: "us-sso-1",
434+
sso_region: "us-sso-region-1",
433435
sso_start_url: "SSO_START_URL",
434436
sso_registration_scopes: "sso:account:access",
435437
};
436438
Object.assign(iniProfileData.default, {
437-
sso_region: "us-sso-1",
439+
sso_region: "us-sso-region-1",
438440
sso_session: "ssoNew",
439441
sso_account_id: "1234",
440442
sso_role_name: "integration-test",
@@ -446,7 +448,7 @@ describe("credential-provider-node integration test", () => {
446448
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
447449
sessionToken: "SSO_SESSION_TOKEN",
448450
expiration: new Date("3000-01-01T00:00:00.000Z"),
449-
credentialScope: "us-sso-1",
451+
credentialScope: "us-sso-1-us-sso-region-1",
450452
});
451453
});
452454
});

0 commit comments

Comments
 (0)