Skip to content

Commit e7f43d1

Browse files
authored
feat: add new integration test runner (#19529)
Creating this PR so that we can iterate on the design of the integration test runner. We will create two packages (names up for debate) 1. `@aws-cdk/integ-runner` (this PR) CLI tool that will execute integration tests 2. `@aws-cdk/integ-tests` (future PR) Library that is used to create integration test cases. This library will synthesize an assembly file that will be consumed by the runner. This PR does not yet implement running new style integration tests (generated from the `@aws-cdk/integ-tests` library). The initial implementation of the runner will only work on the legacy (i.e. existing) integration tests. ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent a81a0a4 commit e7f43d1

File tree

77 files changed

+5413
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5413
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './cloud-assembly';
22
export * from './assets';
33
export * from './manifest';
4+
export * from './integ-tests';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
/**
2+
* In what scenarios should the CLI ask for approval
3+
*/
4+
export enum RequireApproval {
5+
/**
6+
* Never ask for approval
7+
*/
8+
NEVER = 'never',
9+
10+
/**
11+
* Prompt for approval for any type of change to the stack
12+
*/
13+
ANYCHANGE = 'any-change',
14+
15+
/**
16+
* Only prompt for approval if there are security related changes
17+
*/
18+
BROADENING = 'broadening'
19+
}
20+
21+
/**
22+
* Default CDK CLI options that apply to all commands
23+
*/
24+
export interface DefaultCdkOptions {
25+
/**
26+
* List of stacks to deploy
27+
*
28+
* Requried if `all` is not set
29+
*
30+
* @default - []
31+
*/
32+
readonly stacks?: string[];
33+
34+
/**
35+
* Deploy all stacks
36+
*
37+
* Requried if `stacks` is not set
38+
*
39+
* @default - false
40+
*/
41+
readonly all?: boolean;
42+
43+
/**
44+
* command-line for executing your app or a cloud assembly directory
45+
* e.g. "node bin/my-app.js"
46+
* or
47+
* "cdk.out"
48+
*
49+
* @default - read from cdk.json
50+
*/
51+
readonly app?: string;
52+
53+
54+
/**
55+
* Role to pass to CloudFormation for deployment
56+
*
57+
* @default - use the bootstrap cfn-exec role
58+
*/
59+
readonly roleArn?: string;
60+
61+
/**
62+
* Additional context
63+
*
64+
* @default - no additional context
65+
*/
66+
readonly context?: { [name: string]: string };
67+
68+
/**
69+
* Print trace for stack warnings
70+
*
71+
* @default false
72+
*/
73+
readonly trace?: boolean;
74+
75+
/**
76+
* Do not construct stacks with warnings
77+
*
78+
* @default false
79+
*/
80+
readonly strict?: boolean;
81+
82+
/**
83+
* Perform context lookups.
84+
*
85+
* Synthesis fails if this is disabled and context lookups need
86+
* to be performed
87+
*
88+
* @default true
89+
*/
90+
readonly lookups?: boolean;
91+
92+
/**
93+
* Ignores synthesis errors, which will likely produce an invalid output
94+
*
95+
* @default false
96+
*/
97+
readonly ignoreErrors?: boolean;
98+
99+
/**
100+
* Use JSON output instead of YAML when templates are printed
101+
* to STDOUT
102+
*
103+
* @default false
104+
*/
105+
readonly json?: boolean;
106+
107+
/**
108+
* show debug logs
109+
*
110+
* @default false
111+
*/
112+
readonly verbose?: boolean;
113+
114+
/**
115+
* enable emission of additional debugging information, such as creation stack
116+
* traces of tokens
117+
*
118+
* @default false
119+
*/
120+
readonly debug?: boolean;
121+
122+
/**
123+
* Use the indicated AWS profile as the default environment
124+
*
125+
* @default - no profile is used
126+
*/
127+
readonly profile?: string;
128+
129+
/**
130+
* Use the indicated proxy. Will read from
131+
* HTTPS_PROXY environment if specified
132+
*
133+
* @default - no proxy
134+
*/
135+
readonly proxy?: string;
136+
137+
/**
138+
* Path to CA certificate to use when validating HTTPS
139+
* requests.
140+
*
141+
* @default - read from AWS_CA_BUNDLE environment variable
142+
*/
143+
readonly caBundlePath?: string;
144+
145+
/**
146+
* Force trying to fetch EC2 instance credentials
147+
*
148+
* @default - guess EC2 instance status
149+
*/
150+
readonly ec2Creds?: boolean;
151+
152+
/**
153+
* Include "AWS::CDK::Metadata" resource in synthesized templates
154+
*
155+
* @default true
156+
*/
157+
readonly versionReporting?: boolean;
158+
159+
/**
160+
* Include "aws:cdk:path" CloudFormation metadata for each resource
161+
*
162+
* @default true
163+
*/
164+
readonly pathMetadata?: boolean;
165+
166+
/**
167+
* Include "aws:asset:*" CloudFormation metadata for resources that use assets
168+
*
169+
* @default true
170+
*/
171+
readonly assetMetadata?: boolean;
172+
173+
/**
174+
* Copy assets to the output directory
175+
*
176+
* Needed for local debugging the source files with SAM CLI
177+
*
178+
* @default false
179+
*/
180+
readonly staging?: boolean;
181+
182+
/**
183+
* Emits the synthesized cloud assembly into a directory
184+
*
185+
* @default cdk.out
186+
*/
187+
readonly output?: string;
188+
189+
/**
190+
* Show relevant notices
191+
*
192+
* @default true
193+
*/
194+
readonly notices?: boolean;
195+
196+
/**
197+
* Show colors and other style from console output
198+
*
199+
* @default true
200+
*/
201+
readonly color?: boolean;
202+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import { DefaultCdkOptions, RequireApproval } from './common';
2+
3+
/**
4+
* Options to use with cdk deploy
5+
*/
6+
export interface DeployOptions extends DefaultCdkOptions {
7+
/**
8+
* Only perform action on the given stack
9+
*
10+
* @default false
11+
*/
12+
readonly exclusively?: boolean;
13+
14+
/**
15+
* Name of the toolkit stack to use/deploy
16+
*
17+
* @default CDKToolkit
18+
*/
19+
readonly toolkitStackName?: string;
20+
21+
/**
22+
* Reuse the assets with the given asset IDs
23+
*
24+
* @default - do not reuse assets
25+
*/
26+
readonly reuseAssets?: string[];
27+
28+
/**
29+
* Optional name to use for the CloudFormation change set.
30+
* If not provided, a name will be generated automatically.
31+
*
32+
* @default - auto generate a name
33+
*/
34+
readonly changeSetName?: string;
35+
36+
/**
37+
* Always deploy, even if templates are identical.
38+
* @default false
39+
*/
40+
readonly force?: boolean;
41+
42+
/**
43+
* Rollback failed deployments
44+
*
45+
* @default true
46+
*/
47+
readonly rollback?: boolean;
48+
49+
/**
50+
* ARNs of SNS topics that CloudFormation will notify with stack related events
51+
*
52+
* @default - no notifications
53+
*/
54+
readonly notificationArns?: string[];
55+
56+
/**
57+
* What kind of security changes require approval
58+
*
59+
* @default RequireApproval.Never
60+
*/
61+
readonly requireApproval?: RequireApproval;
62+
63+
/**
64+
* Whether to execute the ChangeSet
65+
* Not providing `execute` parameter will result in execution of ChangeSet
66+
* @default true
67+
*/
68+
readonly execute?: boolean;
69+
70+
/**
71+
* Additional parameters for CloudFormation at deploy time
72+
* @default {}
73+
*/
74+
readonly parameters?: { [name: string]: string };
75+
76+
/**
77+
* Use previous values for unspecified parameters
78+
*
79+
* If not set, all parameters must be specified for every deployment.
80+
*
81+
* @default true
82+
*/
83+
readonly usePreviousParameters?: boolean;
84+
85+
/**
86+
* Path to file where stack outputs will be written after a successful deploy as JSON
87+
* @default - Outputs are not written to any file
88+
*/
89+
readonly outputsFile?: string;
90+
91+
/**
92+
* Whether we are on a CI system
93+
*
94+
* @default false
95+
*/
96+
readonly ci?: boolean;
97+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { DefaultCdkOptions } from './common';
2+
3+
/**
4+
* Options to use with cdk destroy
5+
*/
6+
export interface DestroyOptions extends DefaultCdkOptions {
7+
/**
8+
* Do not ask for permission before destroying stacks
9+
*
10+
* @default false
11+
*/
12+
readonly force?: boolean;
13+
14+
/**
15+
* Only destroy the given stack
16+
*
17+
* @default false
18+
*/
19+
readonly exclusively?: boolean;
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './common';
2+
export * from './deploy';
3+
export * from './destroy';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './schema';
2+
export * from './commands';
3+
export * from './test-case';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { TestCase } from './test-case';
2+
/**
3+
* Definitions for the integration testing manifest
4+
*/
5+
export interface IntegManifest {
6+
/**
7+
* Version of the manifest
8+
*/
9+
readonly version: string;
10+
11+
/**
12+
* Enable lookups for this test. If lookups are enabled
13+
* then `stackUpdateWorkflow` must be set to false.
14+
* Lookups should only be enabled when you are explicitely testing
15+
* lookups.
16+
*
17+
* @default false
18+
*/
19+
readonly enableLookups?: boolean;
20+
21+
/**
22+
* test cases
23+
*/
24+
readonly testCases: { [testName: string]: TestCase };
25+
}
26+

0 commit comments

Comments
 (0)