diff --git a/.github/workflows/integration-test-deployment.yml b/.github/workflows/integration-test-deployment.yml deleted file mode 100644 index 841976ab66ba0..0000000000000 --- a/.github/workflows/integration-test-deployment.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: Integration Test deployment - -permissions: - id-token: write # This is required for requesting the OIDC JWT ID token - -on: - workflow_dispatch: {} - merge_group: {} - pull_request_target: - branches: - - main - paths: - - '**.js.snapshot**' - -# In each PR, cancel any previous deployment integration test in progress for that PR -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -jobs: - integration_test_deployment: - runs-on: codebuild-aws-cdk-github-actions-deployment-integ-runner-${{ github.run_id }}-${{ github.run_attempt }} - environment: deployment-integ-test # Do not change or remove this without discussing with Appsec - - env: - PR_BUILD: true - - steps: - - name: Checkout BASE - uses: actions/checkout@v5 - with: - ref: ${{ github.event.pull_request.base.sha }} - fetch-depth: 0 - path: base - - - name: Checkout HEAD - uses: actions/checkout@v5 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - path: head - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v5 - with: - role-to-assume: ${{ vars.CDK_ATMOSPHERE_OIDC_ROLE }} - role-session-name: run-tests@aws-cdk-deployment-integ - aws-region: us-east-1 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "lts/*" - cache: "yarn" - cache-dependency-path: | - base/yarn.lock - head/yarn.lock - - - name: Set up Docker - uses: docker/setup-buildx-action@v3 - - - name: Load Docker images - id: docker-cache - uses: actions/cache/restore@v4 - with: - path: | - ~/.docker-images.tar - key: docker-cache-${{ runner.os }} - - - name: Restore Docker images - if: ${{ steps.docker-cache.outputs.cache-hit }} - run: docker image load --input ~/.docker-images.tar - - - name: Cache build artifacts - uses: actions/cache@v4 - with: - path: | - ~/.s3buildcache - key: s3buildcache-${{ runner.os }} - - #Increases vm.max_map_count for memory intensive jobs - - name: Configure system settings for - run: | - (command -v sysctl || sudo apt-get update && sudo apt-get install -y procps) && \ - sudo sysctl -w vm.max_map_count=2251954 - - - name: Install dependencies for integration-test-deployment (BASE) - working-directory: base - run: yarn --cwd tools/@aws-cdk/integration-test-deployment install - - - name: Build deployment-integ (BASE) - working-directory: base - run: yarn --cwd tools/@aws-cdk/integration-test-deployment build - - - name: Install dependencies for Integration Tests (HEAD) - working-directory: head - run: yarn install - - - name: Build Integration Tests (HEAD) - working-directory: head - run: npx lerna run build --scope=@aws-cdk-testing/framework-integ - - - name: Run integration tests from HEAD using integration-test-deployment script from BASE - run: yarn --cwd ../base/tools/@aws-cdk/integration-test-deployment/ integration-test-deployment - working-directory: head - env: - CDK_ATMOSPHERE_ENDPOINT: ${{ vars.CDK_ATMOSPHERE_ENDPOINT }} - CDK_ATMOSPHERE_POOL: ${{ vars.CDK_ATMOSPHERE_POOL}} - TARGET_BRANCH_COMMIT: ${{ github.event.pull_request.base.sha }} - SOURCE_BRANCH_COMMIT: ${{ github.event.pull_request.head.sha }} - - - name: Export Docker images - if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - run: docker image save --output ~/.docker-images.tar $(docker image list --format '{{ if ne .Repository "" }}{{ .Repository }}{{ if ne .Tag "" }}:{{ .Tag }}{{ end }}{{ else }}{{ .ID }}{{ end }}') - - - name: Cache Docker images - if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} - uses: actions/cache/save@v4 - with: - path: | - ~/.docker-images.tar - key: docker-cache-${{ runner.os }} diff --git a/lerna.json b/lerna.json index d7e0c3bb404d4..b3a10278ccfd5 100644 --- a/lerna.json +++ b/lerna.json @@ -20,7 +20,6 @@ "tools/@aws-cdk/lambda-integration-test-updater", "tools/@aws-cdk/construct-metadata-updater", "tools/@aws-cdk/project-sync", - "tools/@aws-cdk/integration-test-deployment", "scripts/@aws-cdk/script-tests" ], "rejectCycles": true, diff --git a/package.json b/package.json index 30f530ea1b0aa..b84c4cf1cb1c1 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,6 @@ "tools/@aws-cdk/spec2cdk", "tools/@aws-cdk/lazify", "tools/@aws-cdk/project-sync", - "tools/@aws-cdk/integration-test-deployment", "tools/@aws-cdk/lambda-integration-test-updater", "tools/@aws-cdk/construct-metadata-updater", "scripts/@aws-cdk/script-tests" diff --git a/tools/@aws-cdk/integration-test-deployment/.eslintrc.js b/tools/@aws-cdk/integration-test-deployment/.eslintrc.js deleted file mode 100644 index c045813e19b83..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; \ No newline at end of file diff --git a/tools/@aws-cdk/integration-test-deployment/.gitignore b/tools/@aws-cdk/integration-test-deployment/.gitignore deleted file mode 100644 index bef31def37928..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.js -*.js.map -*.d.ts -dist - -.LAST_BUILD -*.snk -!jest.config.js - -.nyc_output -coverage -nyc.config.js -!.eslintrc.js -!test/test-fixture/jsii/node_modules/ -junit.xml diff --git a/tools/@aws-cdk/integration-test-deployment/LICENSE b/tools/@aws-cdk/integration-test-deployment/LICENSE deleted file mode 100644 index eb98d22ca8d4b..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/@aws-cdk/integration-test-deployment/README.md b/tools/@aws-cdk/integration-test-deployment/README.md deleted file mode 100644 index e8217493be9fe..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# CDK Integration Test Deployment - -A tool for running AWS CDK integration tests against changed snapshots using AWS Atmosphere for environment allocation. - -## Overview - -This tool automatically detects changed integration test snapshots in the CDK repository and runs them against real AWS environments managed by Atmosphere. It ensures that CDK changes don't break existing functionality by testing them in isolated AWS accounts. - -This tool is used by the [Integration Test Deployment workflow](../../../.github/workflows/codebuild-pr-deployment-integ.yml). - -## Features - -- **Automatic Change Detection**: Filters through the changed files to detect the integration tests -- **AWS Environment Management**: Integrates with AWS Atmosphere for temporary AWS account allocation -- **Isolated Testing**: Each test run gets its own AWS environment with proper credentials -- **Cleanup**: Automatically releases AWS resources after test completion - -## Prerequisites - -Authenticating to assume atmosphere role through OIDC token. - -## Environment Variables - -| Variable | Description -|----------|------------- -| `CDK_ATMOSPHERE_ENDPOINT` | AWS Atmosphere service endpoint -| `CDK_ATMOSPHERE_POOL` | AWS account pool name for allocation - -## Development - -```bash -# Directory of the tool -cd tools/@aws-cdk/integration-test-deployment/ - -# Install dependencies -yarn install - -# Build -yarn build - -# Run tests -yarn test -``` - -## Usage - -```bash -# Set required environment variables -export CDK_ATMOSPHERE_ENDPOINT="https://your-atmosphere-endpoint" -export CDK_ATMOSPHERE_POOL="your-pool-name" - -# Run the tool -yarn --cwd tools/@aws-cdk/integration-test-deployment/ integration-test-deployment -``` - -## Deployment Options - -This tool supports two deployment modes: - -### 1. Atmosphere Mode (CI/CD) -Uses AWS Atmosphere to automatically provision temporary AWS credentials and isolated test environments. This mode requires special OIDC permissions and is primarily used in CI/CD pipelines. - -**Limitations**: Cannot be run locally due to Atmosphere's authentication requirements. - -### 2. Local Mode (Development) -Run the `deployIntegrationTests` function directly using your own AWS credentials. This allows local testing against your AWS account. - -**Requirements**: Valid AWS credentials must be provided via function parameters - -## How It Works - -1. **Change Detection**: Scans Git diff for modified `integ.*.js` files -2. **Environment Allocation**: Requests temporary AWS account from Atmosphere -3. **Test Execution**: Runs `yarn integ-runner` with allocated AWS credentials -4. **Cleanup**: Releases AWS environment regardless of test outcome -5. **Result**: Exits with success/failure based on test results - - -## License - -Apache-2.0 \ No newline at end of file diff --git a/tools/@aws-cdk/integration-test-deployment/bin/index.ts b/tools/@aws-cdk/integration-test-deployment/bin/index.ts deleted file mode 100755 index 04c6ffb74b59d..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/bin/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env node -import { deployInegTestsWithAtmosphere } from '../lib/integration-test-runner'; - -const endpoint = process.env.CDK_ATMOSPHERE_ENDPOINT; -const pool = process.env.CDK_ATMOSPHERE_POOL; - -if (!endpoint) { - throw new Error('CDK_ATMOSPHERE_ENDPOINT environment variable is required'); -} - -if (!pool) { - throw new Error('CDK_ATMOSPHERE_POOL environment variable is required'); -} - -deployInegTestsWithAtmosphere({ endpoint, pool }); \ No newline at end of file diff --git a/tools/@aws-cdk/integration-test-deployment/jest.config.js b/tools/@aws-cdk/integration-test-deployment/jest.config.js deleted file mode 100644 index 9a7e1a9cb0b61..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; \ No newline at end of file diff --git a/tools/@aws-cdk/integration-test-deployment/lib/atmosphere.ts b/tools/@aws-cdk/integration-test-deployment/lib/atmosphere.ts deleted file mode 100644 index 4e82524323362..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/lib/atmosphere.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Allocation, AtmosphereClient } from '@cdklabs/cdk-atmosphere-client'; - -export class AtmosphereAllocation { - static async acquire({ endpoint, pool }: {endpoint: string; pool: string}): Promise { - const client = new AtmosphereClient(endpoint); - const allocation = await client.acquire({ pool, requester: 'deployment-integ' }); - return new AtmosphereAllocation(client, allocation); - } - - private client: AtmosphereClient; - public allocation: Allocation; - - constructor(client: AtmosphereClient, allocation: Allocation) { - this.client = client; - this.allocation = allocation; - } - - async release(outcome: string): Promise { - return this.client.release(this.allocation.id, outcome); - } -} diff --git a/tools/@aws-cdk/integration-test-deployment/lib/integration-test-runner.ts b/tools/@aws-cdk/integration-test-deployment/lib/integration-test-runner.ts deleted file mode 100644 index e153062b2c586..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/lib/integration-test-runner.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { spawn } from 'child_process'; -import { AtmosphereAllocation } from './atmosphere'; -import { getChangedSnapshots } from './utils'; - -export const deployInegTestsWithAtmosphere = async ({ endpoint, pool }: {endpoint: string; pool: string}) => { - const allocation = await AtmosphereAllocation.acquire({ endpoint, pool }); - let outcome = 'failure'; - - try { - const env = { - AWS_ACCESS_KEY_ID: allocation.allocation.credentials.accessKeyId, - AWS_SECRET_ACCESS_KEY: allocation.allocation.credentials.secretAccessKey, - AWS_SESSION_TOKEN: allocation.allocation.credentials.sessionToken, - AWS_REGION: allocation.allocation.environment.region, - AWS_ACCOUNT_ID: allocation.allocation.environment.account, - TARGET_BRANCH_COMMIT: process.env.TARGET_BRANCH_COMMIT, - SOURCE_BRANCH_COMMIT: process.env.SOURCE_BRANCH_COMMIT, - }; - - await deployIntegrationTests(env); - outcome = 'success'; - } catch (e) { - console.error(e); - } finally { - await allocation.release(outcome); - } - - if (outcome == 'failure') { - throw Error('Deployment integration test did not pass'); - } -}; - -export const deployIntegrationTests = async (env: NodeJS.ProcessEnv) => { - const changedSnapshotPaths = await getChangedSnapshots(); - console.log(`Detected changed snapshots:\n${changedSnapshotPaths.join('\n')}`); - - if (changedSnapshotPaths.length == 0) { - throw new Error('No snapshots changed, skipping deployment integ test.'); - } - - const spawnProcess = spawn('yarn', ['integ-runner', '--directory', 'packages', '--force', ...changedSnapshotPaths], { - stdio: ['ignore', 'inherit', 'inherit'], - env, - }); - - return new Promise((resolve, reject) => spawnProcess.on('close', (code) => { - if (code == 0) resolve(); - else reject(new Error(`Integration tests failed with exit code ${code}`)); - })); -}; diff --git a/tools/@aws-cdk/integration-test-deployment/lib/utils.ts b/tools/@aws-cdk/integration-test-deployment/lib/utils.ts deleted file mode 100644 index 93adf1222d87d..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/lib/utils.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { spawn } from 'child_process'; - -export const gitDiff = async (): Promise => { - if(!process.env.TARGET_BRANCH_COMMIT || !process.env.SOURCE_BRANCH_COMMIT) throw new Error('Environment variables TARGET_BRANCH_COMMIT and SOURCE_BRANCH_COMMIT were not set'); - - const spawnProcess = spawn('git', ['diff', process.env.TARGET_BRANCH_COMMIT, process.env.SOURCE_BRANCH_COMMIT, '--name-only'], { - stdio: ['ignore', 'pipe', 'inherit'], - }); - - let output = ''; - spawnProcess.stdout.on('data', (data) => output += data); - - return new Promise((resolve, reject) => spawnProcess.on('close', (code) => { - console.log(`git diff output:\n${output}`); - if (code == 0) resolve(output); - else reject(`git diff process failed with exit code ${code}`); - })); -}; - -// Get file paths for .integ.*.js files that were modified between the source and target branches -export const getChangedSnapshots = async (): Promise => [ - ...new Set( - (await gitDiff()).split('\n') - .map(val => { - const match = val.match(/^.*integ\.[^/]*\.js/); - return match ? match[0].replace(/(\.js).*$/, '$1') : null; - }) - .filter(val => val !== null) - ), -]; \ No newline at end of file diff --git a/tools/@aws-cdk/integration-test-deployment/package.json b/tools/@aws-cdk/integration-test-deployment/package.json deleted file mode 100644 index a8a08de7a528c..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@aws-cdk/integration-test-deployment", - "version": "0.0.0", - "private": true, - "bin": { - "integration-test-deployment": "bin/index.js" - }, - "scripts": { - "clean": "tsc --build --clean", - "build": "tsc --build", - "build+test": "npm run build && npm run test", - "lint": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern lib bin test", - "package": "mkdir -p dist/js && mv $(npm pack) dist/js/", - "test": "jest --passWithNoTests --updateSnapshot --coverage=false", - "test:watch": "jest --watch", - "watch": "tsc --build -w tsconfig.json", - "integration-test-deployment": "node bin/index.js" - }, - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@cdklabs/cdk-atmosphere-client": "^0.0.62", - "jest": "^29", - "ts-jest": "^29.4.1", - "typescript": "~5.5.4" - }, - "main": "bin/project-sync.js", - "license": "Apache-2.0" -} diff --git a/tools/@aws-cdk/integration-test-deployment/test/atmosphere-mock.ts b/tools/@aws-cdk/integration-test-deployment/test/atmosphere-mock.ts deleted file mode 100644 index 171a0d7ca5fe6..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/test/atmosphere-mock.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Allocation } from '@cdklabs/cdk-atmosphere-client'; - -export class AtmosphereAllocationMock { - static async acquire({ endpoint, pool }: {endpoint: string; pool: string}): Promise { - return new AtmosphereAllocationMock(endpoint, pool); - } - - public allocation: Allocation; - public releaseCalled = false; - - constructor(_endpoint: string, pool: string) { - this.allocation = { - id: `allocation-for-pool-${pool}`, - environment: { - account: '123456789', - region: 'us-east-1', - }, - credentials: { - accessKeyId: 'XXXXXXXXXXXXX', - secretAccessKey: '123456789', - sessionToken: '123456789', - }, - }; - } - - async release(outcome: string): Promise { - this.releaseCalled = true; - return { success: true, outcome }; - } -} diff --git a/tools/@aws-cdk/integration-test-deployment/test/git-diff-expected-changed-snapshots.ts b/tools/@aws-cdk/integration-test-deployment/test/git-diff-expected-changed-snapshots.ts deleted file mode 100644 index a76bdcf78f019..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/test/git-diff-expected-changed-snapshots.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const expectedChangedSnapshots = [ - 'packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js', - 'packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.nlb-sg.js', - 'packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js', -]; diff --git a/tools/@aws-cdk/integration-test-deployment/test/git-diff-snapshot.txt b/tools/@aws-cdk/integration-test-deployment/test/git-diff-snapshot.txt deleted file mode 100644 index fb1f49146d819..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/test/git-diff-snapshot.txt +++ /dev/null @@ -1,11 +0,0 @@ -.github/workflows/codebuild-pr-deployment-integ.yml -packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.template.json -packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.ts -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.nlb-sg.js.snapshot/aws-ecs-integ-lb-fargate.assets.json -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.nlb-sg.js.snapshot/cdk.out -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.nlb-sg.js.snapshot/integ.json -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.assets.json -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/cdk.out -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/integ.json -packages/@aws-cdk/aws-eks-v2-alpha/test/k8s-manifest.test.ts -packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/integ.json diff --git a/tools/@aws-cdk/integration-test-deployment/test/git-mock.ts b/tools/@aws-cdk/integration-test-deployment/test/git-mock.ts deleted file mode 100644 index 2123bb30f3753..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/test/git-mock.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { readFileSync } from 'fs'; -import { join } from 'path'; - -export const gitDiffMock = async (): Promise => { - return readFileSync(join(__dirname, 'git-diff-snapshot.txt'), 'utf8'); -}; diff --git a/tools/@aws-cdk/integration-test-deployment/test/integration-test-deployment.test.ts b/tools/@aws-cdk/integration-test-deployment/test/integration-test-deployment.test.ts deleted file mode 100644 index 08872cc3947d9..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/test/integration-test-deployment.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { describe, expect, jest, test, beforeEach } from '@jest/globals'; -import { AtmosphereAllocationMock } from './atmosphere-mock'; -import { AtmosphereAllocation } from '../lib/atmosphere'; -import { gitDiffMock } from './git-mock'; -import * as utils from '../lib/utils'; -import * as integRunner from '../lib/integration-test-runner'; - -jest.mock('../lib/atmosphere'); - -describe('Run Inegration Tests with Atmosphere', () => { - let mockAtmosphereAllocation: AtmosphereAllocationMock; - - beforeEach(() => { - mockAtmosphereAllocation = new AtmosphereAllocationMock('test-endpoint', 'test-pool'); - jest.spyOn(AtmosphereAllocation, 'acquire').mockImplementation(async () => { - return mockAtmosphereAllocation as any; - }); - jest.spyOn(utils, 'gitDiff').mockImplementation(gitDiffMock); - jest.spyOn(mockAtmosphereAllocation, 'release'); - jest.spyOn(integRunner, 'deployIntegrationTests').mockImplementation(async () => {}); - }); - - test('successful integration test', async () => { - const endpoint = 'https://test-endpoint.com'; - const pool = 'test-pool'; - - await integRunner.deployInegTestsWithAtmosphere({ endpoint, pool }); - expect(AtmosphereAllocation.acquire).toHaveBeenCalled(); - expect(integRunner.deployIntegrationTests).toHaveBeenCalledWith(expect.objectContaining({ - AWS_ACCESS_KEY_ID: 'XXXXXXXXXXXXX', - AWS_SECRET_ACCESS_KEY: '123456789', - AWS_SESSION_TOKEN: '123456789', - AWS_REGION: 'us-east-1', - AWS_ACCOUNT_ID: '123456789', - })); - expect(mockAtmosphereAllocation.release).toHaveBeenCalled(); - }); - - test('failed integration test', async () => { - jest.spyOn(integRunner, 'deployIntegrationTests').mockImplementation(() => { - return Promise.reject(new Error('Integration tests failed with exit code 1')); - }); - - const endpoint = 'https://test-endpoint.com'; - const pool = 'test-pool'; - - await expect(integRunner.deployInegTestsWithAtmosphere({ endpoint, pool })).rejects.toThrow( - 'Deployment integration test did not pass', - ); - - expect(AtmosphereAllocation.acquire).toHaveBeenCalled(); - expect(integRunner.deployIntegrationTests).toHaveBeenCalledWith(expect.objectContaining({ - AWS_ACCESS_KEY_ID: 'XXXXXXXXXXXXX', - AWS_SECRET_ACCESS_KEY: '123456789', - AWS_SESSION_TOKEN: '123456789', - AWS_REGION: 'us-east-1', - AWS_ACCOUNT_ID: '123456789', - })); - expect(mockAtmosphereAllocation.release).toHaveBeenCalled(); - }); -}); diff --git a/tools/@aws-cdk/integration-test-deployment/test/updated-integration-test-detection.test.ts b/tools/@aws-cdk/integration-test-deployment/test/updated-integration-test-detection.test.ts deleted file mode 100644 index 6d1d6a480a092..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/test/updated-integration-test-detection.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, jest, test } from '@jest/globals'; -import { gitDiffMock } from './git-mock'; -import { expectedChangedSnapshots } from './git-diff-expected-changed-snapshots'; -import * as utils from '../lib/utils'; - -jest.spyOn(utils, 'gitDiff').mockImplementation(gitDiffMock); - -describe('Ingreation Test Snapshot', () => { - - test('git diff provides correct snapshot changes', async () => { - const changedSnapshots = await utils.getChangedSnapshots(); - - expect(changedSnapshots.length).toBe(expectedChangedSnapshots.length); - expect(changedSnapshots).toEqual(expect.arrayContaining(expectedChangedSnapshots)); - }); -}); diff --git a/tools/@aws-cdk/integration-test-deployment/tsconfig.json b/tools/@aws-cdk/integration-test-deployment/tsconfig.json deleted file mode 100644 index 1d47f9bea274b..0000000000000 --- a/tools/@aws-cdk/integration-test-deployment/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "lib": ["es2020", "dom"], - "strict": true, - "alwaysStrict": true, - "declaration": true, - "inlineSourceMap": true, - "inlineSources": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "composite": true, - "incremental": true, - "moduleResolution": "node", - "types": ["node"], - "outDir": "." - }, - "include": ["**/*.ts"], - "exclude": ["**/*.d.ts"] -}