@aws-cdk-testing/cli-integ 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +9 -0
- package/LICENSE +202 -0
- package/NOTICE +16 -0
- package/README.md +205 -0
- package/bin/apply-patches +22 -0
- package/bin/download-and-run-old-tests +52 -0
- package/bin/query-github +2 -0
- package/bin/query-github.d.ts +1 -0
- package/bin/query-github.js +54 -0
- package/bin/query-github.ts +56 -0
- package/bin/run-suite +2 -0
- package/bin/run-suite.d.ts +1 -0
- package/bin/run-suite.js +131 -0
- package/bin/run-suite.ts +140 -0
- package/bin/stage-distribution +2 -0
- package/bin/stage-distribution.d.ts +1 -0
- package/bin/stage-distribution.js +217 -0
- package/bin/stage-distribution.ts +267 -0
- package/bin/test-root +2 -0
- package/bin/test-root.d.ts +1 -0
- package/bin/test-root.js +6 -0
- package/bin/test-root.ts +3 -0
- package/entrypoints/test-cli-regression-against-current-code.sh +11 -0
- package/entrypoints/test-cli-regression-against-latest-release.sh +11 -0
- package/entrypoints/test-cli-regression.bash +83 -0
- package/entrypoints/test.sh +12 -0
- package/lib/aws.d.ts +51 -0
- package/lib/aws.js +206 -0
- package/lib/aws.ts +263 -0
- package/lib/corking.d.ts +12 -0
- package/lib/corking.js +35 -0
- package/lib/corking.ts +33 -0
- package/lib/eventually.d.ts +20 -0
- package/lib/eventually.js +34 -0
- package/lib/eventually.ts +42 -0
- package/lib/files.d.ts +15 -0
- package/lib/files.js +80 -0
- package/lib/files.ts +80 -0
- package/lib/github.d.ts +4 -0
- package/lib/github.js +43 -0
- package/lib/github.ts +43 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +30 -0
- package/lib/index.ts +13 -0
- package/lib/integ-test.d.ts +10 -0
- package/lib/integ-test.js +70 -0
- package/lib/integ-test.ts +81 -0
- package/lib/lists.d.ts +1 -0
- package/lib/lists.js +11 -0
- package/lib/lists.ts +9 -0
- package/lib/memoize.d.ts +6 -0
- package/lib/memoize.js +18 -0
- package/lib/memoize.ts +14 -0
- package/lib/npm.d.ts +8 -0
- package/lib/npm.js +38 -0
- package/lib/npm.ts +41 -0
- package/lib/package-sources/release-source.d.ts +23 -0
- package/lib/package-sources/release-source.js +71 -0
- package/lib/package-sources/release-source.ts +81 -0
- package/lib/package-sources/repo-source.d.ts +30 -0
- package/lib/package-sources/repo-source.js +97 -0
- package/lib/package-sources/repo-source.ts +111 -0
- package/lib/package-sources/repo-tools/npm +2 -0
- package/lib/package-sources/repo-tools/npm.d.ts +1 -0
- package/lib/package-sources/repo-tools/npm.js +43 -0
- package/lib/package-sources/repo-tools/npm.ts +48 -0
- package/lib/package-sources/source.d.ts +28 -0
- package/lib/package-sources/source.js +3 -0
- package/lib/package-sources/source.ts +35 -0
- package/lib/package-sources/subprocess.d.ts +3 -0
- package/lib/package-sources/subprocess.js +17 -0
- package/lib/package-sources/subprocess.ts +15 -0
- package/lib/resource-pool.d.ts +50 -0
- package/lib/resource-pool.js +117 -0
- package/lib/resource-pool.ts +140 -0
- package/lib/resources.d.ts +1 -0
- package/lib/resources.js +6 -0
- package/lib/resources.ts +4 -0
- package/lib/shell.d.ts +56 -0
- package/lib/shell.js +123 -0
- package/lib/shell.ts +168 -0
- package/lib/staging/codeartifact.d.ts +44 -0
- package/lib/staging/codeartifact.js +281 -0
- package/lib/staging/codeartifact.ts +387 -0
- package/lib/staging/maven.d.ts +5 -0
- package/lib/staging/maven.js +91 -0
- package/lib/staging/maven.ts +95 -0
- package/lib/staging/npm.d.ts +4 -0
- package/lib/staging/npm.js +55 -0
- package/lib/staging/npm.ts +62 -0
- package/lib/staging/nuget.d.ts +4 -0
- package/lib/staging/nuget.js +69 -0
- package/lib/staging/nuget.ts +75 -0
- package/lib/staging/parallel-shell.d.ts +5 -0
- package/lib/staging/parallel-shell.js +45 -0
- package/lib/staging/parallel-shell.ts +51 -0
- package/lib/staging/pypi.d.ts +4 -0
- package/lib/staging/pypi.js +48 -0
- package/lib/staging/pypi.ts +50 -0
- package/lib/staging/usage-dir.d.ts +31 -0
- package/lib/staging/usage-dir.js +87 -0
- package/lib/staging/usage-dir.ts +99 -0
- package/lib/with-aws.d.ts +14 -0
- package/lib/with-aws.js +60 -0
- package/lib/with-aws.ts +67 -0
- package/lib/with-cdk-app.d.ts +210 -0
- package/lib/with-cdk-app.js +539 -0
- package/lib/with-cdk-app.ts +742 -0
- package/lib/with-cli-lib.d.ts +17 -0
- package/lib/with-cli-lib.js +123 -0
- package/lib/with-cli-lib.ts +134 -0
- package/lib/with-packages.d.ts +5 -0
- package/lib/with-packages.js +13 -0
- package/lib/with-packages.ts +15 -0
- package/lib/with-sam.d.ts +33 -0
- package/lib/with-sam.js +258 -0
- package/lib/with-sam.ts +288 -0
- package/lib/with-temporary-directory.d.ts +5 -0
- package/lib/with-temporary-directory.js +31 -0
- package/lib/with-temporary-directory.ts +35 -0
- package/lib/with-timeout.d.ts +19 -0
- package/lib/with-timeout.js +34 -0
- package/lib/with-timeout.ts +33 -0
- package/lib/xpmutex.d.ts +43 -0
- package/lib/xpmutex.js +207 -0
- package/lib/xpmutex.ts +218 -0
- package/package.json +111 -0
- package/resources/bootstrap-templates/session-tags.all-roles-deny-all.yaml +703 -0
- package/resources/bootstrap-templates/session-tags.deploy-role-deny-sqs.yaml +700 -0
- package/resources/cdk-apps/app/app.js +926 -0
- package/resources/cdk-apps/app/appsync.hotswap.graphql +3 -0
- package/resources/cdk-apps/app/cdk.json +7 -0
- package/resources/cdk-apps/app/docker/Dockerfile +2 -0
- package/resources/cdk-apps/app/docker/Dockerfile.Custom +2 -0
- package/resources/cdk-apps/app/lambda/index.js +4 -0
- package/resources/cdk-apps/app/lambda/response.json +3 -0
- package/resources/cdk-apps/app/nested-stack.js +65 -0
- package/resources/cdk-apps/cfn-include-app/cdk.json +4 -0
- package/resources/cdk-apps/cfn-include-app/cfn-include-app.js +21 -0
- package/resources/cdk-apps/cfn-include-app/example-template.json +13 -0
- package/resources/cdk-apps/rollback-test-app/app.js +110 -0
- package/resources/cdk-apps/rollback-test-app/cdk.json +7 -0
- package/resources/cdk-apps/sam_cdk_integ_app/bin/test-app.js +11 -0
- package/resources/cdk-apps/sam_cdk_integ_app/cdk.json +6 -0
- package/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +19 -0
- package/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +134 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/.no-packagejson-validator +0 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/Dockerfile +9 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/app.js +22 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/docker/DockerImageFunctionConstruct/package.json +18 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/go.mod +5 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/go.sum +17 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/go/GoFunctionConstruct/main.go +17 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/.no-packagejson-validator +0 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/app.ts +16 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/package-lock.json +12 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/nodejs/NodeJsFunctionConstruct/package.json +5 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Function/app.py +15 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Function/requirements.txt +1 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Layer/layer_version_dependency.py +5 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/python/Layer/requirements.txt +1 -0
- package/resources/cdk-apps/sam_cdk_integ_app/src/rest-api-definition.yaml +12 -0
- package/resources/cdk-apps/simple-app/app.js +26 -0
- package/resources/cdk-apps/simple-app/cdk.json +7 -0
- package/resources/cli-regression-patches/v1.119.0/NOTES.md +5 -0
- package/resources/cli-regression-patches/v1.119.0/cli.integtest.js +659 -0
- package/resources/cli-regression-patches/v1.130.0/NOTES.md +12 -0
- package/resources/cli-regression-patches/v1.130.0/app/app.js +378 -0
- package/resources/cli-regression-patches/v1.130.0/bootstrapping.integtest.js +220 -0
- package/resources/cli-regression-patches/v1.44.0/NOTES.md +18 -0
- package/resources/cli-regression-patches/v1.44.0/bootstrapping.integtest.js +126 -0
- package/resources/cli-regression-patches/v1.44.0/test.sh +26 -0
- package/resources/cli-regression-patches/v1.61.1/NOTES.md +2 -0
- package/resources/cli-regression-patches/v1.61.1/skip-tests.txt +16 -0
- package/resources/cli-regression-patches/v1.62.0/NOTES.md +2 -0
- package/resources/cli-regression-patches/v1.62.0/aws-helpers.js +245 -0
- package/resources/cli-regression-patches/v1.63.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v1.63.0/skip-tests.txt +7 -0
- package/resources/cli-regression-patches/v1.64.0/NOTES.md +3 -0
- package/resources/cli-regression-patches/v1.64.0/cdk-helpers.js +325 -0
- package/resources/cli-regression-patches/v1.64.0/cli.integtest.js +599 -0
- package/resources/cli-regression-patches/v1.64.1/NOTES.md +3 -0
- package/resources/cli-regression-patches/v1.64.1/cdk-helpers.js +324 -0
- package/resources/cli-regression-patches/v1.64.1/cli.integtest.js +599 -0
- package/resources/cli-regression-patches/v1.67.0/NOTES.md +2 -0
- package/resources/cli-regression-patches/v1.67.0/cdk-helpers.js +331 -0
- package/resources/cli-regression-patches/v2.130.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/nested-stack.js +19 -0
- package/resources/cli-regression-patches/v2.130.0/node_modules/@aws-cdk-testing/cli-integ/resources/cdk-apps/sam_cdk_integ_app/lib/test-stack.js +134 -0
- package/resources/cli-regression-patches/v2.130.0/skip-tests.txt +5 -0
- package/resources/cli-regression-patches/v2.132.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.132.0/skip-tests.txt +4 -0
- package/resources/cli-regression-patches/v2.142.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.142.0/skip-tests.txt +4 -0
- package/resources/cli-regression-patches/v2.160.0/skip-tests.txt +2 -0
- package/resources/cli-regression-patches/v2.161.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.161.0/skip-tests.txt +5 -0
- package/resources/cli-regression-patches/v2.166.0/NOTES.md +1 -0
- package/resources/cli-regression-patches/v2.166.0/skip-tests.txt +2 -0
- package/resources/cloud-assemblies/0.36.0/InitStack.template.json +1 -0
- package/resources/cloud-assemblies/0.36.0/cdk.out +1 -0
- package/resources/cloud-assemblies/0.36.0/manifest.json +19 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/InitStack.template.json +2 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/cdk.out +1 -0
- package/resources/cloud-assemblies/1.10.0-lookup-default-vpc/manifest.json.js +37 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/InitStack.template.json +2 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/cdk.out +1 -0
- package/resources/cloud-assemblies/1.10.0-request-azs/manifest.json.js +34 -0
- package/resources/integ.jest.config.js +25 -0
- package/resources/templates/sqs-template.json +36 -0
- package/skip-tests.txt +8 -0
- package/tests/cli-integ-tests/README.md +47 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.js +412 -0
- package/tests/cli-integ-tests/bootstrapping.integtest.ts +493 -0
- package/tests/cli-integ-tests/cli-lib.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/cli-lib.integtest.js +62 -0
- package/tests/cli-integ-tests/cli-lib.integtest.ts +90 -0
- package/tests/cli-integ-tests/cli.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/cli.integtest.js +2104 -0
- package/tests/cli-integ-tests/cli.integtest.ts +2874 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.d.ts +1 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.js +314 -0
- package/tests/cli-integ-tests/garbage-collection.integtest.ts +392 -0
- package/tests/init-csharp/init-csharp.integtest.d.ts +1 -0
- package/tests/init-csharp/init-csharp.integtest.js +14 -0
- package/tests/init-csharp/init-csharp.integtest.ts +15 -0
- package/tests/init-fsharp/init-fsharp.integtest.d.ts +1 -0
- package/tests/init-fsharp/init-fsharp.integtest.js +14 -0
- package/tests/init-fsharp/init-fsharp.integtest.ts +15 -0
- package/tests/init-go/init-go.integtest.d.ts +1 -0
- package/tests/init-go/init-go.integtest.js +21 -0
- package/tests/init-go/init-go.integtest.ts +23 -0
- package/tests/init-java/init-java.integtest.d.ts +1 -0
- package/tests/init-java/init-java.integtest.js +14 -0
- package/tests/init-java/init-java.integtest.ts +14 -0
- package/tests/init-javascript/init-javascript.integtest.d.ts +1 -0
- package/tests/init-javascript/init-javascript.integtest.js +53 -0
- package/tests/init-javascript/init-javascript.integtest.ts +59 -0
- package/tests/init-python/init-python.integtest.d.ts +1 -0
- package/tests/init-python/init-python.integtest.js +19 -0
- package/tests/init-python/init-python.integtest.ts +20 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.d.ts +1 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.js +54 -0
- package/tests/init-typescript-app/init-typescript-app.integtest.ts +66 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.d.ts +1 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.js +13 -0
- package/tests/init-typescript-lib/init-typescript-lib.integtest.ts +13 -0
- package/tests/tool-integrations/amplify.integtest.d.ts +1 -0
- package/tests/tool-integrations/amplify.integtest.js +39 -0
- package/tests/tool-integrations/amplify.integtest.ts +43 -0
- package/tests/tool-integrations/with-tool-context.d.ts +9 -0
- package/tests/tool-integrations/with-tool-context.js +13 -0
- package/tests/tool-integrations/with-tool-context.ts +14 -0
- package/tests/uberpackage/uberpackage.integtest.d.ts +1 -0
- package/tests/uberpackage/uberpackage.integtest.js +11 -0
- package/tests/uberpackage/uberpackage.integtest.ts +11 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs-extra';
|
|
3
|
+
import { copyDirectoryContents, homeDir, loadLines, updateIniKey, writeLines } from '../files';
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_USAGE_DIR = path.join(homeDir(), '.codeartifact/usage');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The usage directory is where we write per-session config files to access the CodeArtifact repository.
|
|
9
|
+
*
|
|
10
|
+
* Some config files may be written in a system-global location, but they will not be active unless the
|
|
11
|
+
* contents of this directory have been sourced/copied into the current terminal.
|
|
12
|
+
*
|
|
13
|
+
* CONTRACT
|
|
14
|
+
*
|
|
15
|
+
* There are two special entries:
|
|
16
|
+
*
|
|
17
|
+
* - `env`, a file with `key=value` entries for environment variables to set.
|
|
18
|
+
* - `cwd/`, a directory with files that need to be copied into the current directory before each command.
|
|
19
|
+
*
|
|
20
|
+
* Other than these, code may write tempfiles to this directory if it wants, but there is no meaning
|
|
21
|
+
* implied for other files.
|
|
22
|
+
*/
|
|
23
|
+
export class UsageDir {
|
|
24
|
+
public static default() {
|
|
25
|
+
return new UsageDir(DEFAULT_USAGE_DIR);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public readonly envFile: string;
|
|
29
|
+
public readonly cwdDir: string;
|
|
30
|
+
|
|
31
|
+
private constructor(public readonly directory: string) {
|
|
32
|
+
this.envFile = path.join(this.directory, 'env');
|
|
33
|
+
this.cwdDir = path.join(this.directory, 'cwd');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async clean() {
|
|
37
|
+
await fs.rm(this.directory, { recursive: true, force: true });
|
|
38
|
+
await fs.mkdirp(path.join(this.directory, 'cwd'));
|
|
39
|
+
await fs.writeFile(path.join(this.directory, 'env'), '', { encoding: 'utf-8' });
|
|
40
|
+
|
|
41
|
+
await this.addToEnv({
|
|
42
|
+
CWD_FILES_DIR: path.join(this.directory, 'cwd'),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Write a bash helper to load these settings
|
|
46
|
+
await fs.writeFile(path.join(this.directory, 'activate.bash'), [
|
|
47
|
+
`while read -u10 line; do [[ -z $line ]] || export "$line"; done 10<${this.directory}/env`,
|
|
48
|
+
'cp -R $CWD_FILES_DIR/ .', // Copy files from directory even if it is empty
|
|
49
|
+
].join('\n'), { encoding: 'utf-8' });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public async addToEnv(settings: Record<string, string>) {
|
|
53
|
+
const lines = await loadLines(this.envFile);
|
|
54
|
+
for (const [k, v] of Object.entries(settings)) {
|
|
55
|
+
updateIniKey(lines, k, v);
|
|
56
|
+
}
|
|
57
|
+
await writeLines(this.envFile, lines);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public async currentEnv(): Promise<Record<string, string>> {
|
|
61
|
+
const lines = await loadLines(this.envFile);
|
|
62
|
+
|
|
63
|
+
const splitter = /^([a-zA-Z0-9_-]+)\s*=\s*(.*)$/;
|
|
64
|
+
|
|
65
|
+
const ret: Record<string, string> = {};
|
|
66
|
+
for (const line of lines) {
|
|
67
|
+
const m = line.match(splitter);
|
|
68
|
+
if (m) {
|
|
69
|
+
ret[m[1]] = m[2];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return ret;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public cwdFile(filename: string) {
|
|
76
|
+
return path.join(this.cwdDir, filename);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public async activateInCurrentProcess() {
|
|
80
|
+
for (const [k, v] of Object.entries(await this.currentEnv())) {
|
|
81
|
+
process.env[k] = v;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
await copyDirectoryContents(this.cwdDir, '.');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public async copyCwdFileHere(...filenames: string[]) {
|
|
88
|
+
for (const file of filenames) {
|
|
89
|
+
await fs.copyFile(path.join(this.cwdDir, file), file);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public advertise() {
|
|
94
|
+
// eslint-disable-next-line no-console
|
|
95
|
+
console.log('To activate these settings in the current terminal:');
|
|
96
|
+
// eslint-disable-next-line no-console
|
|
97
|
+
console.log(` source ${this.directory}/activate.bash`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AwsClients } from './aws';
|
|
2
|
+
import { TestContext } from './integ-test';
|
|
3
|
+
import { ResourcePool } from './resource-pool';
|
|
4
|
+
import { DisableBootstrapContext } from './with-cdk-app';
|
|
5
|
+
export type AwsContext = {
|
|
6
|
+
readonly aws: AwsClients;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Higher order function to execute a block with an AWS client setup
|
|
10
|
+
*
|
|
11
|
+
* Allocate the next region from the REGION pool and dispose it afterwards.
|
|
12
|
+
*/
|
|
13
|
+
export declare function withAws<A extends TestContext>(block: (context: A & AwsContext & DisableBootstrapContext) => Promise<void>, disableBootstrap?: boolean): (context: A) => Promise<void>;
|
|
14
|
+
export declare function regionPool(): ResourcePool;
|
package/lib/with-aws.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withAws = withAws;
|
|
4
|
+
exports.regionPool = regionPool;
|
|
5
|
+
const aws_1 = require("./aws");
|
|
6
|
+
const resource_pool_1 = require("./resource-pool");
|
|
7
|
+
/**
|
|
8
|
+
* Higher order function to execute a block with an AWS client setup
|
|
9
|
+
*
|
|
10
|
+
* Allocate the next region from the REGION pool and dispose it afterwards.
|
|
11
|
+
*/
|
|
12
|
+
function withAws(block, disableBootstrap = false) {
|
|
13
|
+
return (context) => regionPool().using(async (region) => {
|
|
14
|
+
const aws = await aws_1.AwsClients.forRegion(region, context.output);
|
|
15
|
+
await sanityCheck(aws);
|
|
16
|
+
return block({ ...context, disableBootstrap, aws });
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
let _regionPool;
|
|
20
|
+
function regionPool() {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (_regionPool !== undefined) {
|
|
23
|
+
return _regionPool;
|
|
24
|
+
}
|
|
25
|
+
const REGIONS = process.env.AWS_REGIONS
|
|
26
|
+
? process.env.AWS_REGIONS.split(',')
|
|
27
|
+
: [(_b = (_a = process.env.AWS_REGION) !== null && _a !== void 0 ? _a : process.env.AWS_DEFAULT_REGION) !== null && _b !== void 0 ? _b : 'us-east-1'];
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
console.log(`Using regions: ${REGIONS}\n`);
|
|
30
|
+
_regionPool = resource_pool_1.ResourcePool.withResources('aws_regions', REGIONS);
|
|
31
|
+
return _regionPool;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Perform a one-time quick sanity check that the AWS clients have properly configured credentials
|
|
35
|
+
*
|
|
36
|
+
* If we don't do this, calls are going to fail and they'll be retried and everything will take
|
|
37
|
+
* forever before the user notices a simple misconfiguration.
|
|
38
|
+
*
|
|
39
|
+
* We can't check for the presence of environment variables since credentials could come from
|
|
40
|
+
* anywhere, so do simple account retrieval.
|
|
41
|
+
*
|
|
42
|
+
* Only do it once per process.
|
|
43
|
+
*/
|
|
44
|
+
async function sanityCheck(aws) {
|
|
45
|
+
if (sanityChecked === undefined) {
|
|
46
|
+
try {
|
|
47
|
+
await aws.account();
|
|
48
|
+
sanityChecked = true;
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
sanityChecked = false;
|
|
52
|
+
throw new Error(`AWS credentials probably not configured, got error: ${e.message}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!sanityChecked) {
|
|
56
|
+
throw new Error('AWS credentials probably not configured, see previous error');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let sanityChecked;
|
|
60
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l0aC1hd3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ3aXRoLWF3cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQVlBLDBCQVVDO0FBR0QsZ0NBY0M7QUF2Q0QsK0JBQW1DO0FBRW5DLG1EQUErQztBQUsvQzs7OztHQUlHO0FBQ0gsU0FBZ0IsT0FBTyxDQUNyQixLQUEyRSxFQUMzRSxtQkFBNEIsS0FBSztJQUVqQyxPQUFPLENBQUMsT0FBVSxFQUFFLEVBQUUsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxLQUFLLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRSxFQUFFO1FBQ3pELE1BQU0sR0FBRyxHQUFHLE1BQU0sZ0JBQVUsQ0FBQyxTQUFTLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUMvRCxNQUFNLFdBQVcsQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUV2QixPQUFPLEtBQUssQ0FBQyxFQUFFLEdBQUcsT0FBTyxFQUFFLGdCQUFnQixFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7SUFDdEQsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDO0FBRUQsSUFBSSxXQUFxQyxDQUFDO0FBQzFDLFNBQWdCLFVBQVU7O0lBQ3hCLElBQUksV0FBVyxLQUFLLFNBQVMsRUFBRSxDQUFDO1FBQzlCLE9BQU8sV0FBVyxDQUFDO0lBQ3JCLENBQUM7SUFFRCxNQUFNLE9BQU8sR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLFdBQVc7UUFDckMsQ0FBQyxDQ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G4gKiBXZSBjYW4ndCBjaGVjayBmb3IgdGhlIHByZXNlbmNlIG9mIGVudmlyb25tZW50IHZhcmlhYmxlcyBzaW5jZSBjcmVkZW50aWFscyBjb3VsZCBjb21lIGZyb21cbiAqIGFueXdoZXJlLCBzbyBkbyBzaW1wbGUgYWNjb3VudCByZXRyaWV2YWwuXG4gKlxuICogT25seSBkbyBpdCBvbmNlIHBlciBwcm9jZXNzLlxuICovXG5hc3luYyBmdW5jdGlvbiBzYW5pdHlDaGVjayhhd3M6IEF3c0NsaWVudHMpIHtcbiAgaWYgKHNhbml0eUNoZWNrZWQgPT09IHVuZGVmaW5lZCkge1xuICAgIHRyeSB7XG4gICAgICBhd2FpdCBhd3MuYWNjb3VudCgpO1xuICAgICAgc2FuaXR5Q2hlY2tlZCA9IHRydWU7XG4gICAgfSBjYXRjaCAoZTogYW55KSB7XG4gICAgICBzYW5pdHlDaGVja2VkID0gZmFsc2U7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoYEFXUyBjcmVkZW50aWFscyBwcm9iYWJseSBub3QgY29uZmlndXJlZCwgZ290IGVycm9yOiAke2UubWVzc2FnZX1gKTtcbiAgICB9XG4gIH1cbiAgaWYgKCFzYW5pdHlDaGVja2VkKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKCdBV1MgY3JlZGVudGlhbHMgcHJvYmFibHkgbm90IGNvbmZpZ3VyZWQsIHNlZSBwcmV2aW91cyBlcnJvcicpO1xuICB9XG59XG5sZXQgc2FuaXR5Q2hlY2tlZDogYm9vbGVhbiB8IHVuZGVmaW5lZDtcbiJdfQ==
|
package/lib/with-aws.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AwsClients } from './aws';
|
|
2
|
+
import { TestContext } from './integ-test';
|
|
3
|
+
import { ResourcePool } from './resource-pool';
|
|
4
|
+
import { DisableBootstrapContext } from './with-cdk-app';
|
|
5
|
+
|
|
6
|
+
export type AwsContext = { readonly aws: AwsClients };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Higher order function to execute a block with an AWS client setup
|
|
10
|
+
*
|
|
11
|
+
* Allocate the next region from the REGION pool and dispose it afterwards.
|
|
12
|
+
*/
|
|
13
|
+
export function withAws<A extends TestContext>(
|
|
14
|
+
block: (context: A & AwsContext & DisableBootstrapContext) => Promise<void>,
|
|
15
|
+
disableBootstrap: boolean = false,
|
|
16
|
+
): (context: A) => Promise<void> {
|
|
17
|
+
return (context: A) => regionPool().using(async (region) => {
|
|
18
|
+
const aws = await AwsClients.forRegion(region, context.output);
|
|
19
|
+
await sanityCheck(aws);
|
|
20
|
+
|
|
21
|
+
return block({ ...context, disableBootstrap, aws });
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let _regionPool: undefined | ResourcePool;
|
|
26
|
+
export function regionPool(): ResourcePool {
|
|
27
|
+
if (_regionPool !== undefined) {
|
|
28
|
+
return _regionPool;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const REGIONS = process.env.AWS_REGIONS
|
|
32
|
+
? process.env.AWS_REGIONS.split(',')
|
|
33
|
+
: [process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? 'us-east-1'];
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.log(`Using regions: ${REGIONS}\n`);
|
|
37
|
+
|
|
38
|
+
_regionPool = ResourcePool.withResources('aws_regions', REGIONS);
|
|
39
|
+
return _regionPool;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Perform a one-time quick sanity check that the AWS clients have properly configured credentials
|
|
44
|
+
*
|
|
45
|
+
* If we don't do this, calls are going to fail and they'll be retried and everything will take
|
|
46
|
+
* forever before the user notices a simple misconfiguration.
|
|
47
|
+
*
|
|
48
|
+
* We can't check for the presence of environment variables since credentials could come from
|
|
49
|
+
* anywhere, so do simple account retrieval.
|
|
50
|
+
*
|
|
51
|
+
* Only do it once per process.
|
|
52
|
+
*/
|
|
53
|
+
async function sanityCheck(aws: AwsClients) {
|
|
54
|
+
if (sanityChecked === undefined) {
|
|
55
|
+
try {
|
|
56
|
+
await aws.account();
|
|
57
|
+
sanityChecked = true;
|
|
58
|
+
} catch (e: any) {
|
|
59
|
+
sanityChecked = false;
|
|
60
|
+
throw new Error(`AWS credentials probably not configured, got error: ${e.message}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!sanityChecked) {
|
|
64
|
+
throw new Error('AWS credentials probably not configured, see previous error');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let sanityChecked: boolean | undefined;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { AwsClients } from './aws';
|
|
2
|
+
import { TestContext } from './integ-test';
|
|
3
|
+
import { IPackageSource } from './package-sources/source';
|
|
4
|
+
import { ShellOptions, ShellHelper } from './shell';
|
|
5
|
+
import { AwsContext } from './with-aws';
|
|
6
|
+
export declare const DEFAULT_TEST_TIMEOUT_S: number;
|
|
7
|
+
export declare const EXTENDED_TEST_TIMEOUT_S: number;
|
|
8
|
+
/**
|
|
9
|
+
* Higher order function to execute a block with a CDK app fixture
|
|
10
|
+
*
|
|
11
|
+
* Requires an AWS client to be passed in.
|
|
12
|
+
*
|
|
13
|
+
* For backwards compatibility with existing tests (so we don't have to change
|
|
14
|
+
* too much) the inner block is expected to take a `TestFixture` object.
|
|
15
|
+
*/
|
|
16
|
+
export declare function withSpecificCdkApp(appName: string, block: (context: TestFixture) => Promise<void>): (context: TestContext & AwsContext & DisableBootstrapContext) => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Like `withSpecificCdkApp`, but uses the default integration testing app with a million stacks in it
|
|
19
|
+
*/
|
|
20
|
+
export declare function withCdkApp(block: (context: TestFixture) => Promise<void>): (context: TestContext & AwsContext & DisableBootstrapContext) => Promise<void>;
|
|
21
|
+
export declare function withCdkMigrateApp<A extends TestContext>(language: string, block: (context: TestFixture) => Promise<void>): (context: A) => Promise<void>;
|
|
22
|
+
export declare function withMonolithicCfnIncludeCdkApp<A extends TestContext>(block: (context: TestFixture) => Promise<void>): (context: A) => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Default test fixture for most (all?) integ tests
|
|
25
|
+
*
|
|
26
|
+
* It's a composition of withAws/withCdkApp, expecting the test block to take a `TestFixture`
|
|
27
|
+
* object.
|
|
28
|
+
*
|
|
29
|
+
* We could have put `withAws(withCdkApp(fixture => { /... actual test here.../ }))` in every
|
|
30
|
+
* test declaration but centralizing it is going to make it convenient to modify in the future.
|
|
31
|
+
*/
|
|
32
|
+
export declare function withDefaultFixture(block: (context: TestFixture) => Promise<void>): (context: TestContext) => Promise<void>;
|
|
33
|
+
export declare function withSpecificFixture(appName: string, block: (context: TestFixture) => Promise<void>): (context: TestContext) => Promise<void>;
|
|
34
|
+
export declare function withExtendedTimeoutFixture(block: (context: TestFixture) => Promise<void>): (context: TestContext) => Promise<void>;
|
|
35
|
+
export declare function withCDKMigrateFixture(language: string, block: (content: TestFixture) => Promise<void>): (context: TestContext) => Promise<void>;
|
|
36
|
+
export interface DisableBootstrapContext {
|
|
37
|
+
/**
|
|
38
|
+
* Whether to disable creating the default bootstrap
|
|
39
|
+
* stack prior to running the test
|
|
40
|
+
*
|
|
41
|
+
* This should be set to true when running tests that
|
|
42
|
+
* explicitly create a bootstrap stack
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
readonly disableBootstrap?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* To be used in place of `withDefaultFixture` when the test
|
|
50
|
+
* should not create the default bootstrap stack
|
|
51
|
+
*/
|
|
52
|
+
export declare function withoutBootstrap(block: (context: TestFixture) => Promise<void>): (context: TestContext) => Promise<void>;
|
|
53
|
+
export interface CdkCliOptions extends ShellOptions {
|
|
54
|
+
options?: string[];
|
|
55
|
+
neverRequireApproval?: boolean;
|
|
56
|
+
verbose?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Prepare a target dir byreplicating a source directory
|
|
60
|
+
*/
|
|
61
|
+
export declare function cloneDirectory(source: string, target: string, output?: NodeJS.WritableStream): Promise<void>;
|
|
62
|
+
interface CommonCdkBootstrapCommandOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Path to a custom bootstrap template.
|
|
65
|
+
*
|
|
66
|
+
* @default - the default CDK bootstrap template.
|
|
67
|
+
*/
|
|
68
|
+
readonly bootstrapTemplate?: string;
|
|
69
|
+
readonly toolkitStackName: string;
|
|
70
|
+
/**
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
readonly verbose?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @default - auto-generated CloudFormation name
|
|
76
|
+
*/
|
|
77
|
+
readonly bootstrapBucketName?: string;
|
|
78
|
+
readonly cliOptions?: CdkCliOptions;
|
|
79
|
+
/**
|
|
80
|
+
* @default - none
|
|
81
|
+
*/
|
|
82
|
+
readonly tags?: string;
|
|
83
|
+
/**
|
|
84
|
+
* @default - the default CDK qualifier
|
|
85
|
+
*/
|
|
86
|
+
readonly qualifier?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface CdkLegacyBootstrapCommandOptions extends CommonCdkBootstrapCommandOptions {
|
|
89
|
+
/**
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
readonly noExecute?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
readonly publicAccessBlockConfiguration?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface CdkModernBootstrapCommandOptions extends CommonCdkBootstrapCommandOptions {
|
|
99
|
+
/**
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
readonly force?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* @default - none
|
|
105
|
+
*/
|
|
106
|
+
readonly cfnExecutionPolicy?: string;
|
|
107
|
+
/**
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
readonly showTemplate?: boolean;
|
|
111
|
+
readonly template?: string;
|
|
112
|
+
/**
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
readonly terminationProtection?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* @default undefined
|
|
118
|
+
*/
|
|
119
|
+
readonly examplePermissionsBoundary?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* @default undefined
|
|
122
|
+
*/
|
|
123
|
+
readonly customPermissionsBoundary?: string;
|
|
124
|
+
/**
|
|
125
|
+
* @default undefined
|
|
126
|
+
*/
|
|
127
|
+
readonly usePreviousParameters?: boolean;
|
|
128
|
+
}
|
|
129
|
+
export interface CdkGarbageCollectionCommandOptions {
|
|
130
|
+
/**
|
|
131
|
+
* The amount of days an asset should stay isolated before deletion, to
|
|
132
|
+
* guard against some pipeline rollback scenarios
|
|
133
|
+
*
|
|
134
|
+
* @default 0
|
|
135
|
+
*/
|
|
136
|
+
readonly rollbackBufferDays?: number;
|
|
137
|
+
/**
|
|
138
|
+
* The type of asset that is getting garbage collected.
|
|
139
|
+
*
|
|
140
|
+
* @default 'all'
|
|
141
|
+
*/
|
|
142
|
+
readonly type?: 'ecr' | 's3' | 'all';
|
|
143
|
+
/**
|
|
144
|
+
* The name of the bootstrap stack
|
|
145
|
+
*
|
|
146
|
+
* @default 'CdkToolkit'
|
|
147
|
+
*/
|
|
148
|
+
readonly bootstrapStackName?: string;
|
|
149
|
+
}
|
|
150
|
+
export declare class TestFixture extends ShellHelper {
|
|
151
|
+
readonly integTestDir: string;
|
|
152
|
+
readonly stackNamePrefix: string;
|
|
153
|
+
readonly output: NodeJS.WritableStream;
|
|
154
|
+
readonly aws: AwsClients;
|
|
155
|
+
readonly randomString: string;
|
|
156
|
+
readonly qualifier: string;
|
|
157
|
+
private readonly bucketsToDelete;
|
|
158
|
+
readonly packages: IPackageSource;
|
|
159
|
+
constructor(integTestDir: string, stackNamePrefix: string, output: NodeJS.WritableStream, aws: AwsClients, randomString: string);
|
|
160
|
+
log(s: string): void;
|
|
161
|
+
cdkDeploy(stackNames: string | string[], options?: CdkCliOptions, skipStackRename?: boolean): Promise<string>;
|
|
162
|
+
cdkSynth(options?: CdkCliOptions): Promise<string>;
|
|
163
|
+
cdkDestroy(stackNames: string | string[], options?: CdkCliOptions): Promise<string>;
|
|
164
|
+
cdkBootstrapLegacy(options: CdkLegacyBootstrapCommandOptions): Promise<string>;
|
|
165
|
+
cdkBootstrapModern(options: CdkModernBootstrapCommandOptions): Promise<string>;
|
|
166
|
+
cdkGarbageCollect(options: CdkGarbageCollectionCommandOptions): Promise<string>;
|
|
167
|
+
cdkMigrate(language: string, stackName: string, inputPath?: string, options?: CdkCliOptions): Promise<string>;
|
|
168
|
+
cdk(args: string[], options?: CdkCliOptions): Promise<string>;
|
|
169
|
+
template(stackName: string): any;
|
|
170
|
+
bootstrapRepoName(): Promise<string>;
|
|
171
|
+
get bootstrapStackName(): string;
|
|
172
|
+
fullStackName(stackName: string): string;
|
|
173
|
+
fullStackName(stackNames: string[]): string[];
|
|
174
|
+
/**
|
|
175
|
+
* Append this to the list of buckets to potentially delete
|
|
176
|
+
*
|
|
177
|
+
* At the end of a test, we clean up buckets that may not have gotten destroyed
|
|
178
|
+
* (for whatever reason).
|
|
179
|
+
*/
|
|
180
|
+
rememberToDeleteBucket(bucketName: string): void;
|
|
181
|
+
/**
|
|
182
|
+
* Cleanup leftover stacks and bootstrapped resources
|
|
183
|
+
*/
|
|
184
|
+
dispose(success: boolean): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Return the stacks starting with our testing prefix that should be deleted
|
|
187
|
+
*/
|
|
188
|
+
private deleteableStacks;
|
|
189
|
+
private sortBootstrapStacksToTheEnd;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Install the given NPM packages, identified by their names and versions
|
|
193
|
+
*
|
|
194
|
+
* Works by writing the packages to a `package.json` file, and
|
|
195
|
+
* then running NPM7's "install" on it. The use of NPM7 will automatically
|
|
196
|
+
* install required peerDependencies.
|
|
197
|
+
*
|
|
198
|
+
* If we're running in REPO mode and we find the package in the set of local
|
|
199
|
+
* packages in the repository, we'll write the directory name to `package.json`
|
|
200
|
+
* so that NPM will create a symlink (this allows running tests against
|
|
201
|
+
* built-but-unpackaged modules, and saves dev cycle time).
|
|
202
|
+
*
|
|
203
|
+
* Be aware you MUST install all the packages you directly depend upon! In the case
|
|
204
|
+
* of a repo/symlinking install, transitive dependencies WILL NOT be installed in the
|
|
205
|
+
* current directory's `node_modules` directory, because they will already have been
|
|
206
|
+
* symlinked from the TARGET directory's `node_modules` directory (which is sufficient
|
|
207
|
+
* for Node's dependency lookup mechanism).
|
|
208
|
+
*/
|
|
209
|
+
export declare function installNpmPackages(fixture: TestFixture, packages: Record<string, string>): Promise<void>;
|
|
210
|
+
export {};
|