From 8411603fe31b2317f1b4611a4c99e599f200ac7d Mon Sep 17 00:00:00 2001 From: George Fu Date: Thu, 31 Oct 2024 00:24:38 +0000 Subject: [PATCH] test: create e2e global hook --- .../test/e2e/CognitoIdentity.e2e.spec.ts | 2 ++ .../vitest.config.e2e.ts | 1 + .../client-kinesis/test/Kinesis.e2e.spec.ts | 11 +++++----- clients/client-kinesis/vitest.config.e2e.ts | 1 + .../client-s3/test/e2e/S3.browser.e2e.spec.ts | 6 ++---- clients/client-s3/test/e2e/S3.e2e.spec.ts | 6 ++---- clients/client-s3/vitest.config.e2e.ts | 1 + .../test/index.e2e.spec.ts | 7 ++++++- .../vitest.config.e2e.ts | 1 + .../src/test/lib-dynamodb.e2e.spec.ts | 2 ++ lib/lib-dynamodb/vitest.config.e2e.ts | 1 + lib/lib-storage/src/lib-storage.e2e.spec.ts | 5 ++--- lib/lib-storage/vitest.config.e2e.ts | 1 + package.json | 2 +- .../src/MetadataService.e2e.spec.ts | 2 ++ .../ec2-metadata-service/vitest.config.e2e.ts | 1 + .../region-redirect-middleware.e2e.spec.ts | 2 ++ .../src/s3-expires-middleware.e2e.spec.ts | 2 ++ .../middleware-s3-express.e2e.spec.ts | 2 ++ .../src/throw-200-exceptions.e2e.spec.ts | 2 ++ .../middleware-sdk-s3/vitest.config.e2e.ts | 1 + .../src/createPresignedPost.e2e.spec.ts | 4 ++-- .../s3-presigned-post/vitest.config.e2e.ts | 1 + private/aws-util-test/package.json | 1 + private/aws-util-test/src/index.ts | 1 + .../aws-util-test/src/set-test-credentials.ts | 3 +++ scripts/turbo/index.js | 9 +++++++++ tests/e2e/get-integ-test-resources.js | 20 ++++--------------- vitest.config.e2e.ts | 1 + 29 files changed, 63 insertions(+), 36 deletions(-) create mode 100644 private/aws-util-test/src/set-test-credentials.ts diff --git a/clients/client-cognito-identity/test/e2e/CognitoIdentity.e2e.spec.ts b/clients/client-cognito-identity/test/e2e/CognitoIdentity.e2e.spec.ts index 836bb76119f0..e62c586e76df 100644 --- a/clients/client-cognito-identity/test/e2e/CognitoIdentity.e2e.spec.ts +++ b/clients/client-cognito-identity/test/e2e/CognitoIdentity.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { beforeAll, describe, expect, test as it } from "vitest"; import { getIntegTestResources } from "../../../../tests/e2e/get-integ-test-resources"; @@ -9,6 +10,7 @@ describe("@aws-sdk/client-cognito-identity", () => { let IdentityPoolId: string; beforeAll(async () => { + await setTestCredentials(); const integTestResourcesEnv = await getIntegTestResources(); Object.assign(process.env, integTestResourcesEnv); diff --git a/clients/client-cognito-identity/vitest.config.e2e.ts b/clients/client-cognito-identity/vitest.config.e2e.ts index a08a0dfa31c3..b521c102edec 100644 --- a/clients/client-cognito-identity/vitest.config.e2e.ts +++ b/clients/client-cognito-identity/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "happy-dom", + env: process.env as Record, }, }); diff --git a/clients/client-kinesis/test/Kinesis.e2e.spec.ts b/clients/client-kinesis/test/Kinesis.e2e.spec.ts index 894b6119bfcb..516c85513e19 100644 --- a/clients/client-kinesis/test/Kinesis.e2e.spec.ts +++ b/clients/client-kinesis/test/Kinesis.e2e.spec.ts @@ -1,14 +1,15 @@ -import { describe, expect, test as it } from "vitest"; +import { setTestCredentials } from "@aws-sdk/aws-util-test"; +import { beforeAll, describe, expect, test as it } from "vitest"; import { KinesisClient, ListStreamsCommand } from "../src/index"; describe("@aws-sdk/client-kinesis", () => { + beforeAll(async () => { + await setTestCredentials(); + }); + const client = new KinesisClient({ region: "us-west-2", - credentials: { - accessKeyId: "CLIENT_TEST", - secretAccessKey: "CLIENT_TEST", - }, }); const ONE_SECOND = 1 * 1000; diff --git a/clients/client-kinesis/vitest.config.e2e.ts b/clients/client-kinesis/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/clients/client-kinesis/vitest.config.e2e.ts +++ b/clients/client-kinesis/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/clients/client-s3/test/e2e/S3.browser.e2e.spec.ts b/clients/client-s3/test/e2e/S3.browser.e2e.spec.ts index ea07494f1417..c188ca6506d0 100644 --- a/clients/client-s3/test/e2e/S3.browser.e2e.spec.ts +++ b/clients/client-s3/test/e2e/S3.browser.e2e.spec.ts @@ -1,7 +1,4 @@ -/** - * This is the integration test that make sure the client can make request cross-platform-ly - * in NodeJS and browsers. - */ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import type { S3, SelectObjectContentEventStream } from "@aws-sdk/client-s3"; import { fromNodeProviderChain } from "@aws-sdk/credential-providers"; import { FetchHttpHandler } from "@smithy/fetch-http-handler"; @@ -20,6 +17,7 @@ describe("@aws-sdk/client-s3", () => { let Key = `${Date.now()}`; beforeAll(async () => { + await setTestCredentials(); const integTestResourcesEnv = await getIntegTestResources(); Object.assign(process.env, integTestResourcesEnv); diff --git a/clients/client-s3/test/e2e/S3.e2e.spec.ts b/clients/client-s3/test/e2e/S3.e2e.spec.ts index b38870fa1e0b..515b4de90e55 100644 --- a/clients/client-s3/test/e2e/S3.e2e.spec.ts +++ b/clients/client-s3/test/e2e/S3.e2e.spec.ts @@ -1,7 +1,7 @@ import "@aws-sdk/signature-v4-crt"; +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { S3, SelectObjectContentEventStream } from "@aws-sdk/client-s3"; -import { AwsCredentialIdentity } from "@aws-sdk/types"; import { afterAll, afterEach, beforeAll, describe, expect, test as it } from "vitest"; import { getIntegTestResources } from "../../../../tests/e2e/get-integ-test-resources"; @@ -13,15 +13,14 @@ describe("@aws-sdk/client-s3", () => { let client: S3; let Bucket: string; let region: string; - let credentials: AwsCredentialIdentity; let mrapArn: string; beforeAll(async () => { + await setTestCredentials(); const integTestResourcesEnv = await getIntegTestResources(); Object.assign(process.env, integTestResourcesEnv); region = process?.env?.AWS_SMOKE_TEST_REGION as string; - credentials = (globalThis as any).credentials || undefined; Bucket = process?.env?.AWS_SMOKE_TEST_BUCKET as string; mrapArn = (globalThis as any)?.window?.__env__?.AWS_SMOKE_TEST_MRAP_ARN || process?.env?.AWS_SMOKE_TEST_MRAP_ARN; @@ -29,7 +28,6 @@ describe("@aws-sdk/client-s3", () => { client = new S3({ region, - credentials, }); }); diff --git a/clients/client-s3/vitest.config.e2e.ts b/clients/client-s3/vitest.config.e2e.ts index eff43a280d0a..a506383cbdb1 100644 --- a/clients/client-s3/vitest.config.e2e.ts +++ b/clients/client-s3/vitest.config.e2e.ts @@ -5,5 +5,6 @@ export default defineConfig({ exclude: ["**/*.browser.e2e.spec.ts"], include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/clients/client-transcribe-streaming/test/index.e2e.spec.ts b/clients/client-transcribe-streaming/test/index.e2e.spec.ts index a3b4d1568b19..97c9be282aa8 100644 --- a/clients/client-transcribe-streaming/test/index.e2e.spec.ts +++ b/clients/client-transcribe-streaming/test/index.e2e.spec.ts @@ -1,6 +1,7 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { createReadStream } from "fs"; import { join } from "path"; -import { afterAll, describe, expect, test as it } from "vitest"; +import { afterAll, beforeAll, describe, expect, test as it } from "vitest"; import { TranscribeStreaming } from "../src/index"; const audio = createReadStream(join(__dirname, "numbers.wav")); @@ -13,6 +14,10 @@ describe("TranscribeStream client", () => { secretAccessKey: "CLIENT_TEST", }, }); + + beforeAll(async () => { + await setTestCredentials(); + }); afterAll(() => { client.destroy(); }); diff --git a/clients/client-transcribe-streaming/vitest.config.e2e.ts b/clients/client-transcribe-streaming/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/clients/client-transcribe-streaming/vitest.config.e2e.ts +++ b/clients/client-transcribe-streaming/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/lib/lib-dynamodb/src/test/lib-dynamodb.e2e.spec.ts b/lib/lib-dynamodb/src/test/lib-dynamodb.e2e.spec.ts index 57b5e7a94738..db49fa8e0949 100644 --- a/lib/lib-dynamodb/src/test/lib-dynamodb.e2e.spec.ts +++ b/lib/lib-dynamodb/src/test/lib-dynamodb.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { BillingMode, CreateTableCommandOutput, @@ -196,6 +197,7 @@ describe( const passError = (e: any) => e; beforeAll(async () => { + await setTestCredentials(); log.describe = await dynamodb .describeTable({ TableName, diff --git a/lib/lib-dynamodb/vitest.config.e2e.ts b/lib/lib-dynamodb/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/lib/lib-dynamodb/vitest.config.e2e.ts +++ b/lib/lib-dynamodb/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/lib/lib-storage/src/lib-storage.e2e.spec.ts b/lib/lib-storage/src/lib-storage.e2e.spec.ts index 1344a5b61ddd..10f41ad8dc72 100644 --- a/lib/lib-storage/src/lib-storage.e2e.spec.ts +++ b/lib/lib-storage/src/lib-storage.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { S3 } from "@aws-sdk/client-s3"; import { Upload } from "@aws-sdk/lib-storage"; import type { AwsCredentialIdentity } from "@smithy/types"; @@ -14,14 +15,13 @@ describe("@aws-sdk/lib-storage", () => { let dataString: string; let Bucket: string; let region: string; - let credentials: AwsCredentialIdentity; beforeAll(async () => { + await setTestCredentials(); const integTestResourcesEnv = await getIntegTestResources(); Object.assign(process.env, integTestResourcesEnv); region = process?.env?.AWS_SMOKE_TEST_REGION as string; - credentials = (globalThis as any).credentials || undefined; Bucket = process?.env?.AWS_SMOKE_TEST_BUCKET as string; Key = ``; @@ -30,7 +30,6 @@ describe("@aws-sdk/lib-storage", () => { client = new S3({ region, - credentials, }); }); diff --git a/lib/lib-storage/vitest.config.e2e.ts b/lib/lib-storage/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/lib/lib-storage/vitest.config.e2e.ts +++ b/lib/lib-storage/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/package.json b/package.json index 8bd377176e6f..bc4d3c6a9baf 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "local-publish": "node ./scripts/verdaccio-publish/index.js", "test:all": "yarn build:all && jest --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}' && yarn test:versions && yarn test:integration", "test:ci": "lerna run test --since origin/main", - "test:e2e": "node ./scripts/turbo test:e2e && node ./tests/canary/canary", + "test:e2e": "node -e \"console.log(process.env)\" && node ./scripts/turbo test:e2e && node ./tests/canary/canary", "test:e2e:legacy": "cucumber-js --fail-fast", "test:e2e:legacy:preview": "./tests/e2e-legacy/preview.mjs", "test:e2e:legacy:since:release": "./tests/e2e-legacy/since-release.mjs", diff --git a/packages/ec2-metadata-service/src/MetadataService.e2e.spec.ts b/packages/ec2-metadata-service/src/MetadataService.e2e.spec.ts index 66f3f43ed70f..9f2a884269e0 100644 --- a/packages/ec2-metadata-service/src/MetadataService.e2e.spec.ts +++ b/packages/ec2-metadata-service/src/MetadataService.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { fromInstanceMetadata } from "@aws-sdk/credential-providers"; import { beforeAll, describe, expect, test as it, vi } from "vitest"; @@ -9,6 +10,7 @@ describe("MetadataService E2E Tests", () => { let metadataServiceAvailable: any; beforeAll(async () => { + await setTestCredentials(); try { await provider(); metadataServiceAvailable = true; diff --git a/packages/ec2-metadata-service/vitest.config.e2e.ts b/packages/ec2-metadata-service/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/packages/ec2-metadata-service/vitest.config.e2e.ts +++ b/packages/ec2-metadata-service/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/packages/middleware-sdk-s3/src/region-redirect-middleware.e2e.spec.ts b/packages/middleware-sdk-s3/src/region-redirect-middleware.e2e.spec.ts index 78ef2589452d..eed48157878c 100644 --- a/packages/middleware-sdk-s3/src/region-redirect-middleware.e2e.spec.ts +++ b/packages/middleware-sdk-s3/src/region-redirect-middleware.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { S3 } from "@aws-sdk/client-s3"; import { GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts"; import { afterAll, beforeAll, describe, expect, test as it } from "vitest"; @@ -22,6 +23,7 @@ describe("S3 Global Client Test", () => { const randId = alphabet[(Math.random() * alphabet.length) | 0] + alphabet[(Math.random() * alphabet.length) | 0]; beforeAll(async () => { + await setTestCredentials(); callerID = await stsClient.getCallerIdentity({}); bucketNames = regionConfigs.map((config) => `${callerID.Account}-${randId}-redirect-${config.region}`); await Promise.all(bucketNames.map((bucketName, index) => deleteBucket(s3Clients[index], bucketName))); diff --git a/packages/middleware-sdk-s3/src/s3-expires-middleware.e2e.spec.ts b/packages/middleware-sdk-s3/src/s3-expires-middleware.e2e.spec.ts index ff45d623bfea..a49190ebffa3 100644 --- a/packages/middleware-sdk-s3/src/s3-expires-middleware.e2e.spec.ts +++ b/packages/middleware-sdk-s3/src/s3-expires-middleware.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { S3 } from "@aws-sdk/client-s3"; import { GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts"; import { afterAll, beforeAll, describe, expect, test as it, vi } from "vitest"; @@ -24,6 +25,7 @@ describe("S3 Expires e2e test", () => { const randId = alphabet[(Math.random() * alphabet.length) | 0] + alphabet[(Math.random() * alphabet.length) | 0]; beforeAll(async () => { + await setTestCredentials(); callerID = await stsClient.getCallerIdentity({}); Bucket = `${callerID.Account}-${randId}-s3-expires`; await s3.createBucket({ diff --git a/packages/middleware-sdk-s3/src/s3-express/middleware-s3-express.e2e.spec.ts b/packages/middleware-sdk-s3/src/s3-express/middleware-s3-express.e2e.spec.ts index 971236036213..26b79a152c53 100644 --- a/packages/middleware-sdk-s3/src/s3-express/middleware-s3-express.e2e.spec.ts +++ b/packages/middleware-sdk-s3/src/s3-express/middleware-s3-express.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { GetObjectCommand, PutObjectCommand, S3, waitUntilBucketExists } from "@aws-sdk/client-s3"; import { STS } from "@aws-sdk/client-sts"; import { getSignedUrl } from "@aws-sdk/s3-request-presigner"; @@ -34,6 +35,7 @@ describe("s3 express CRUD test suite", () => { let readWriteDeleteRecorder: typeof recorder.calls; beforeAll(async () => { + await setTestCredentials(); ({ s3, controller, bucketName, recorder } = await createClientAndRecorder()); await s3.createBucket({ diff --git a/packages/middleware-sdk-s3/src/throw-200-exceptions.e2e.spec.ts b/packages/middleware-sdk-s3/src/throw-200-exceptions.e2e.spec.ts index 8ef2d004fb42..024099266e0e 100644 --- a/packages/middleware-sdk-s3/src/throw-200-exceptions.e2e.spec.ts +++ b/packages/middleware-sdk-s3/src/throw-200-exceptions.e2e.spec.ts @@ -1,3 +1,4 @@ +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { S3 } from "@aws-sdk/client-s3"; import { GetCallerIdentityCommandOutput, STS } from "@aws-sdk/client-sts"; import { afterAll, beforeAll, describe, test as it } from "vitest"; @@ -15,6 +16,7 @@ describe("S3 throw 200 exceptions", () => { let callerID: GetCallerIdentityCommandOutput; beforeAll(async () => { + await setTestCredentials(); callerID = await stsClient.getCallerIdentity({}); Bucket = `${callerID.Account}-${randId}-s3-200s-e2e-test-empty-${config.region}-${(Date.now() / 1000) | 0}`; diff --git a/packages/middleware-sdk-s3/vitest.config.e2e.ts b/packages/middleware-sdk-s3/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/packages/middleware-sdk-s3/vitest.config.e2e.ts +++ b/packages/middleware-sdk-s3/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/packages/s3-presigned-post/src/createPresignedPost.e2e.spec.ts b/packages/s3-presigned-post/src/createPresignedPost.e2e.spec.ts index e94d25782069..99daf9969d6e 100644 --- a/packages/s3-presigned-post/src/createPresignedPost.e2e.spec.ts +++ b/packages/s3-presigned-post/src/createPresignedPost.e2e.spec.ts @@ -1,5 +1,4 @@ -// Run using AWS_SMOKE_TEST_REGION=[Region] AWS_SMOKE_TEST_BUCKET=[Bucket] yarn test:e2e -// These params are established in /tests/e2e. +import { setTestCredentials } from "@aws-sdk/aws-util-test"; import { NoSuchKey, S3 } from "@aws-sdk/client-s3"; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test as it } from "vitest"; @@ -16,6 +15,7 @@ describe(createPresignedPost.name, () => { let region: string; beforeAll(async () => { + await setTestCredentials(); const integTestResourcesEnv = await getIntegTestResources(); Object.assign(process.env, integTestResourcesEnv); diff --git a/packages/s3-presigned-post/vitest.config.e2e.ts b/packages/s3-presigned-post/vitest.config.e2e.ts index 92073c6cfcf0..10fbbd4755a7 100644 --- a/packages/s3-presigned-post/vitest.config.e2e.ts +++ b/packages/s3-presigned-post/vitest.config.e2e.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, }); diff --git a/private/aws-util-test/package.json b/private/aws-util-test/package.json index b0047559fedb..3ed4a7d7de92 100644 --- a/private/aws-util-test/package.json +++ b/private/aws-util-test/package.json @@ -19,6 +19,7 @@ "dependencies": { "@aws-sdk/aws-protocoltests-json": "*", "@smithy/protocol-http": "^4.1.4", + "@smithy/shared-ini-file-loader": "^3.1.8", "@smithy/types": "^3.5.0", "tslib": "^2.6.2" }, diff --git a/private/aws-util-test/src/index.ts b/private/aws-util-test/src/index.ts index b85d6584258a..9843dbc862aa 100644 --- a/private/aws-util-test/src/index.ts +++ b/private/aws-util-test/src/index.ts @@ -1 +1,2 @@ export * from "./requests/test-http-handler"; +export * from "./set-test-credentials"; diff --git a/private/aws-util-test/src/set-test-credentials.ts b/private/aws-util-test/src/set-test-credentials.ts new file mode 100644 index 000000000000..31418a3c7e52 --- /dev/null +++ b/private/aws-util-test/src/set-test-credentials.ts @@ -0,0 +1,3 @@ +export const setTestCredentials = async () => { + // no-op +}; diff --git a/scripts/turbo/index.js b/scripts/turbo/index.js index b5640e799e7e..598cf71a97df 100644 --- a/scripts/turbo/index.js +++ b/scripts/turbo/index.js @@ -1,11 +1,20 @@ // Build script to handle Turborepo build execution const { spawnProcess } = require("../utils/spawn-process"); const path = require("path"); +const { loadSharedConfigFiles } = require("@smithy/shared-ini-file-loader"); const runTurbo = async (task, args, { apiSecret, apiEndpoint, apiSignatureKey } = {}) => { const command = ["turbo", "run", task, "--concurrency=100%", "--output-logs=hash-only"]; command.push(...args); const turboRoot = path.join(__dirname, "..", ".."); + + const ini = await loadSharedConfigFiles(); + const profileData = ini.configFile["sdk-integ-test"]; + if (profileData) { + console.log("Setting AWS_PROFILE=sdk-integ-test"); + process.env.AWS_PROFILE = "sdk-integ-test"; + } + try { return await spawnProcess("yarn", command, { stdio: "inherit", diff --git a/tests/e2e/get-integ-test-resources.js b/tests/e2e/get-integ-test-resources.js index 083a13474022..49b70dfff4d4 100644 --- a/tests/e2e/get-integ-test-resources.js +++ b/tests/e2e/get-integ-test-resources.js @@ -6,27 +6,15 @@ const { S3ControlClient, ListMultiRegionAccessPointsCommand } = require("@aws-sd const { ensureTestStack } = require("./ensure-test-stack"); const { deleteStaleChangesets } = require("./delete-stale-changesets"); const { loadSharedConfigFiles } = require("@smithy/shared-ini-file-loader"); -const { createCredentialChain, fromIni, fromHttp } = require("@aws-sdk/credential-providers"); exports.getIntegTestResources = async () => { - const ini = await loadSharedConfigFiles(); - 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); - } - const region = "us-west-2"; + + console.log({ files: JSON.stringify(await loadSharedConfigFiles(), null, 2), ENV: process.env }); + const cloudformation = new CloudFormationClient({ region, + logger: console, }); const stackName = "SdkReleaseV3IntegTestResourcesStack"; diff --git a/vitest.config.e2e.ts b/vitest.config.e2e.ts index d035dcc4e507..203feb72a96d 100644 --- a/vitest.config.e2e.ts +++ b/vitest.config.e2e.ts @@ -5,5 +5,6 @@ export default defineConfig({ exclude: ["node_modules", "**/*.browser.e2e.spec.ts"], include: ["**/*.e2e.spec.ts"], environment: "node", + env: process.env as Record, }, });