Skip to content

Commit

Permalink
chore: switch to using the new integ-runner (#19826)
Browse files Browse the repository at this point in the history
This PR is a follow up to #19802 which added all of the new integ test
snapshots that are used by the new `integ-runner` tool. This PR switches
out the old `cdk-integ` tool for the new `integ-runner`.

Updates made:
1. Update all `package.json` files to install and use the `integ-runner`
2. Update `cdk-test` to use `integ-runner`
3. Updates snapshots for 2 tests that were changed since #19802 was merged.


----

### 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*
  • Loading branch information
corymhall authored and otaviomacedo committed Apr 11, 2022
1 parent a1ba867 commit 973f6ff
Show file tree
Hide file tree
Showing 306 changed files with 34,608 additions and 493 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
### 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`)?
* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn 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*
6 changes: 3 additions & 3 deletions INTEGRATION_TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on what type of changes require integrations tests and how you should write inte
All Construct libraries in the CDK code base have integration tests that serve to -

1. Acts as a regression detector. It does this by running `cdk synth` on the integration test and comparing it against
the `*.expected.json` file. This highlights how a change affects the synthesized stacks.
the Cloud Assembly stored in the snapshot (`*.integ.snapshot/`) directory. This highlights how a change affects the synthesized stacks.
2. Allows for a way to verify if the stacks are still valid CloudFormation templates, as part of an intrusive change.
This is done by running `yarn integ` which will run `cdk deploy` across all of the integration tests in that package.
If you are developing a new integration test or for some other reason want to work on a single integration test
Expand Down Expand Up @@ -102,14 +102,14 @@ To run the test you would run:

*Note - filename must be `*.js`*
```
npm run cdk-integ integ.lambda.js
yarn integ --update-on-failed integ.lambda.js
```

This will:
1. Synthesize the CDK app
2. `cdk deploy` to your AWS account
3. `cdk destroy` to delete the stack
4. Save a snapshot of the synthed CloudFormation template to `integ.lambda.expected.json`
4. Save a snapshot of the Cloud Assembly to `lambda.integ.snapshot/`

Now when you run `npm test` it will synth the integ app and compare the result with the snapshot.
If the snapshot has changed the same process must be followed to update the snapshot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ nyc.config.js

junit.xml

!jest.config.js
!jest.config.js
!**/*.integ.snapshot/**/asset.*/*.js
!**/*.integ.snapshot/**/asset.*/*.d.ts

!**/*.integ.snapshot/**/asset.*/**
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ tsconfig.json
junit.xml

test/
jest.config.js
jest.config.js
**/*.integ.snapshot
**/*.integ.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"watch": "cdk-watch",
"lint": "cdk-lint",
"test": "cdk-test",
"integ": "cdk-integ",
"integ": "integ-runner",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint",
Expand All @@ -39,7 +39,7 @@
"devDependencies": {
"@types/jest": "^27.4.1",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/integ-runner": "0.0.0",
"@aws-cdk/aws-autoscaling": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"jest": "^27.5.1",
Expand Down
Loading

0 comments on commit 973f6ff

Please sign in to comment.