Skip to content

Commit

Permalink
test(credential-provider-node): check sso region in integ test (#5791)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Feb 13, 2024
1 parent 0bc9f48 commit 0cb2dd7
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ jest.mock("@aws-sdk/client-sso", () => {
return {
...actual,
SSOClient: class {
public constructor(public config: any) {}
async send() {
return {
roleCredentials: {
accessKeyId: "SSO_ACCESS_KEY_ID",
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
sessionToken: "SSO_SESSION_TOKEN",
expiration: new Date("3000-01-01T00:00:00.000Z"),
credentialScope: "us-sso-1",
credentialScope: "us-sso-1-" + this.config.region,
},
};
}
Expand Down Expand Up @@ -285,11 +286,12 @@ describe("credential-provider-node integration test", () => {
describe("fromSSO", () => {
it("should resolve SSO credentials if legacy SSO parameters are supplied directly", async () => {
sts = new STS({
region: "us-sso-1",
// this is lower priority than the ssoRegion.
region: "us-sso-region-2",
credentials: defaultProvider({
ssoStartUrl: "SSO_START_URL",
ssoAccountId: "1234",
ssoRegion: "us-sso-1",
ssoRegion: "us-sso-region-1",
ssoRoleName: "sso-role",
}),
requestHandler: mockRequestHandler,
Expand All @@ -301,7 +303,7 @@ describe("credential-provider-node integration test", () => {
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
sessionToken: "SSO_SESSION_TOKEN",
expiration: new Date("3000-01-01T00:00:00.000Z"),
credentialScope: "us-sso-1",
credentialScope: "us-sso-1-us-sso-region-1",
});
});
});
Expand Down Expand Up @@ -429,12 +431,12 @@ describe("credential-provider-node integration test", () => {

it("should resolve SSO credentials if the profile is an SSO profile", async () => {
iniProfileData["sso-session.ssoNew"] = {
sso_region: "us-sso-1",
sso_region: "us-sso-region-1",
sso_start_url: "SSO_START_URL",
sso_registration_scopes: "sso:account:access",
};
Object.assign(iniProfileData.default, {
sso_region: "us-sso-1",
sso_region: "us-sso-region-1",
sso_session: "ssoNew",
sso_account_id: "1234",
sso_role_name: "integration-test",
Expand All @@ -446,7 +448,7 @@ describe("credential-provider-node integration test", () => {
secretAccessKey: "SSO_SECRET_ACCESS_KEY",
sessionToken: "SSO_SESSION_TOKEN",
expiration: new Date("3000-01-01T00:00:00.000Z"),
credentialScope: "us-sso-1",
credentialScope: "us-sso-1-us-sso-region-1",
});
});
});
Expand Down

0 comments on commit 0cb2dd7

Please sign in to comment.