From d560239f618e1c8a5672835b84e3fc31ca3c88b9 Mon Sep 17 00:00:00 2001 From: George Fu Date: Wed, 30 Oct 2024 21:54:23 +0000 Subject: [PATCH] test: what is even going on --- tests/e2e/delete-stale-changesets.js | 2 +- tests/e2e/ensure-test-stack.js | 2 +- tests/e2e/get-integ-test-resources.js | 25 +++++++++++++------------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/e2e/delete-stale-changesets.js b/tests/e2e/delete-stale-changesets.js index 45634c3a0541..cb523d84fe2c 100644 --- a/tests/e2e/delete-stale-changesets.js +++ b/tests/e2e/delete-stale-changesets.js @@ -1,4 +1,4 @@ -const { ListChangeSetsCommand, DeleteChangeSetCommand } = require("../../clients/client-cloudformation"); +const { ListChangeSetsCommand, DeleteChangeSetCommand } = require("@aws-sdk/client-cloudformation"); exports.deleteStaleChangesets = async (client, stackName) => { const changesets = await client.send( diff --git a/tests/e2e/ensure-test-stack.js b/tests/e2e/ensure-test-stack.js index 5c153b11423d..00daa44c8af8 100644 --- a/tests/e2e/ensure-test-stack.js +++ b/tests/e2e/ensure-test-stack.js @@ -8,7 +8,7 @@ const { waitUntilStackCreateComplete, DescribeChangeSetCommand, DeleteChangeSetCommand, -} = require("../../clients/client-cloudformation"); +} = require("@aws-sdk/client-cloudformation"); /** * Deploy the integration test stack if it does not exist. Update the diff --git a/tests/e2e/get-integ-test-resources.js b/tests/e2e/get-integ-test-resources.js index 85dd86cbed76..083a13474022 100644 --- a/tests/e2e/get-integ-test-resources.js +++ b/tests/e2e/get-integ-test-resources.js @@ -1,28 +1,29 @@ const { readFileSync } = require("fs"); const { join } = require("path"); -const { STSClient, GetCallerIdentityCommand } = require("../../clients/client-sts"); -const { CloudFormationClient, DescribeStackResourcesCommand } = require("../../clients/client-cloudformation"); -const { S3ControlClient, ListMultiRegionAccessPointsCommand } = require("../../clients/client-s3-control"); +const { STSClient, GetCallerIdentityCommand } = require("@aws-sdk/client-sts"); +const { CloudFormationClient, DescribeStackResourcesCommand } = require("@aws-sdk/client-cloudformation"); +const { S3ControlClient, ListMultiRegionAccessPointsCommand } = require("@aws-sdk/client-s3-control"); const { ensureTestStack } = require("./ensure-test-stack"); const { deleteStaleChangesets } = require("./delete-stale-changesets"); const { loadSharedConfigFiles } = require("@smithy/shared-ini-file-loader"); -const { fromIni } = require("@aws-sdk/credential-providers"); +const { createCredentialChain, fromIni, fromHttp } = require("@aws-sdk/credential-providers"); exports.getIntegTestResources = async () => { const ini = await loadSharedConfigFiles(); - if (ini.configFile["sdk-integ-test"] || ini.credentialsFile["sdk-integ-test"]) { - process.env.AWS_PROFILE = "sdk-integ-test"; + const profileData = ini.configFile["sdk-integ-test"] ?? ini.credentialsFile["sdk-integ-test"]; + if (profileData) { console.log("Setting AWS_PROFILE=sdk-integ-test"); + process.env.AWS_PROFILE = "sdk-integ-test"; + if (profileData.role_arn) { + console.log( + `Setting AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}` + ); + process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = `/role-arn/${profileData.role_arn}`; + } } else { console.log("AWS_PROFILE is", process.env.AWS_PROFILE); } - // TODO(debug) - console.log({ - config: ini.configFile, - credentials: ini.credentialsFile, - }); - const region = "us-west-2"; const cloudformation = new CloudFormationClient({ region,