feat: add new integration test runner#19529
feat: add new integration test runner#19529mergify[bot] merged 22 commits intoaws:masterfrom corymhall:corymhall/integ-test-runner
Conversation
|
|
||
| This will search for integration tests recursively from the current directory and then execute them in parallel across `us-east-1`, `us-east-2`, & `us-west-2`. | ||
|
|
||
| ### integ.json schema |
There was a problem hiding this comment.
This would be added as a new schema in @aws-cdk/cloud-assembly-schema
| You would then use the `IntegTest` construct to create your test cases | ||
|
|
||
| ```ts | ||
| new IntegTeset(app, 'ArmTest', { |
There was a problem hiding this comment.
This could be a Construct that uses attachCustomSynthesis to synthesize the manifest.
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 package) CLI tool that will execute integration tests 2. `@aws-cdk/integ-tests` Library that is used to create integration test cases. This library will synthesize an assembly file that will be consumed by the runner.
Co-authored-by: Jonathan Goldwasser <jogold@users.noreply.github.com>
| interface MyIntegTestProps extends StackOptions { | ||
| functionProps?: FunctionOptions; | ||
| } | ||
| class MyIntegTest extends Stack { |
There was a problem hiding this comment.
Is this the stack under test?
There was a problem hiding this comment.
Potentially. But maybe only if we add it to a "test case"? That would allow us to do things like only verify certain stacks within a snapshot (not sure if there is an actual need for this)
|
|
||
| 1. Check if a snapshot file exists (i.e. `/integ.*.expected.snapshot$/`) | ||
| 2. If the snapshot does not exist | ||
| 2a. Synth the integ app which will produce the `integ.json` file |
There was a problem hiding this comment.
If I understand it correctly, for each integ.*.ts, it will generate an integ.json file plus as many snapshots as there are tests (instances of IntegTest) in the integ.*.ts file. Is this correct?
There was a problem hiding this comment.
I was thinking that there would be a 1:1 between integ.*.ts and snapshots. Maybe we change the name of the construct to something like IntegTestCase?
An integ.*.ts file contains an "Integration Test" which corresponds to a single CDK application (i.e. one snapshot). Within that application we can create any number of Stacks which we then use in "test cases".
We could also model it differently where you create a single IntegTest and then register any test cases to it integTest.addTestCase()
| * | ||
| * @default true | ||
| */ | ||
| readonly update?: boolean; |
There was a problem hiding this comment.
This update property has a different meaning than the --update command line arg, right? I wonder if this may cause some confusion.
There was a problem hiding this comment.
Good point, what about stackUpdateWorkflow?
| @@ -0,0 +1,20 @@ | |||
| import { Writable } from 'stream'; | |||
There was a problem hiding this comment.
I took this file from packages/aws-cdk. It might be better if we had a shared library we could put stuff like this.
There was a problem hiding this comment.
Is there anything in core that we could reuse?
| "type": "aws:cdk:logicalId", | ||
| "data": "MyFunction1ServiceRole9852B06B", | ||
| "trace": [ | ||
| "new Role (/home/hallcor/work/aws-cdk/integ-test-runner/packages/@aws-cdk/aws-iam/lib/role.js:50:22)", |
There was a problem hiding this comment.
We are not diffing this trace, but should we find a way to remove this?
|
|
||
| const diagnostics = new Array<Diagnostic>(); | ||
| if (!argv.force) { | ||
| const requests = batchTests(testsFromArgs); |
There was a problem hiding this comment.
(minor) there are two responsibilities in this method: manage the execution of snapshot tests (lines 97 to 116) and manage the execution of integration tests (119 to 148). I suggest you extract them to two different methods.
- Moving commands back to `cdk-cli-wrapper` - Adding parameter for enabling lookups
packages/@aws-cdk/integ-runner/lib/workers/integ-test-worker.ts
Outdated
Show resolved
Hide resolved
packages/@aws-cdk/integ-runner/lib/workers/integ-test-worker.ts
Outdated
Show resolved
Hide resolved
|
|
||
| async function runTest(): Promise<void> { | ||
| do { | ||
| const region = queue.nextAvailableRegion; |
There was a problem hiding this comment.
What is the advantage of doing this versus fixing a region per execution?
There was a problem hiding this comment.
That is a good point, i'll do that instead.
There was a problem hiding this comment.
Done! Don't need that queue anymore! Much simpler.
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This reverts commit e7f43d1.
This reverts commit e7f43d1. ---- ### 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*
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*
…s#19651) This reverts commit e7f43d1. ---- ### 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*

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)
@aws-cdk/integ-runner(this PR)CLI tool that will execute integration tests
@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-testslibrary).The initial implementation of the runner will only work on the legacy (i.e. existing) integration tests.
All Submissions:
Adding new Unconventional Dependencies:
New Features
cdk-integto deploy the infrastructure and generate the snapshot (i.e.cdk-integwithout--dry-run)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license