Skip to content

Commit

Permalink
fix(integ-runner): only diff registered stacks (#20100)
Browse files Browse the repository at this point in the history
Currently the runner will perform a diff of all stacks in the snapshot,
not just the stacks that have been "registered" as part of the test
case. This PR changes the logic to only perform a diff on stacks that
are part of the test case. This will allow us to use separate stacks for
things like assertions that will not be part of the diff.

As part of this change it was necessary to make some additional changes
to the way the runner runs the tests, the main reason being that it is
necessary to hold two different versions of the test, the "expected"
version and the "actual" version.

This PR updates the runner to read the "expected" version of the test
from the `integ.json` manifest in the current snapshot and the "actual"
version of the test from the changed integ test. Because the legacy
tests (those that don't use the `IntegTest` construct) do not create an
`integ.json` file, this PR updates the runner to create an `integ.json`
file as part of the snapshot creation. This way on the next change the
runner is able to read the `integ.json` file from the snapshot to get
the "expected" view of the test.


----

### All Submissions:

* [x] 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 `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*
  • Loading branch information
corymhall committed Apr 27, 2022
1 parent 91f9aff commit 721bd4b
Show file tree
Hide file tree
Showing 518 changed files with 7,543 additions and 283 deletions.
14 changes: 14 additions & 0 deletions packages/@aws-cdk/app-delivery/test/cicd.integ.snapshot/integ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"app-delivery/test/integ.cicd": {
"stacks": [
"CICD"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-amplify/test/integ.app-asset-deployment": {
"stacks": [
"cdk-amplify-app-asset-deployment"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-amplify/test/integ.app-codecommit": {
"stacks": [
"cdk-amplify-codecommit-app"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-amplify/test/app.integ.snapshot/integ.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-amplify/test/integ.app": {
"stacks": [
"cdk-amplify-app"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.api-definition.asset": {
"stacks": [
"integtest-restapi-fromdefinition-asset"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.api-definition.inline": {
"stacks": [
"integtest-restapi-fromdefinition-inline"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/authorizers/integ.cognito-authorizer": {
"stacks": [
"CognitoUserPoolsAuthorizerInteg"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/authorizers/integ.request-authorizer.lit": {
"stacks": [
"RequestAuthorizerInteg"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/authorizers/integ.token-authorizer-iam-role": {
"stacks": [
"TokenAuthorizerIAMRoleInteg"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/authorizers/integ.token-authorizer.lit": {
"stacks": [
"TokenAuthorizerInteg"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.cors": {
"stacks": [
"cors-twitch-test"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.lambda-api.latebound-deploymentstage": {
"stacks": [
"LateBoundDeploymentStageStack"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi-import.lit": {
"stacks": [
"integ-restapi-import-RootStack"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi.books": {
"stacks": [
"restapi-books-example"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi.defaults": {
"stacks": [
"test-apigateway-restapi-defaults"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi": {
"stacks": [
"test-apigateway-restapi"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi.multistack": {
"stacks": [
"*"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi.multiuse": {
"stacks": [
"restapi-multiuse-example"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.restapi.vpc-endpoint": {
"stacks": [
"test-apigateway-vpcendpoint"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.stepfunctions-api": {
"stacks": [
"StepFunctionsRestApiDeploymentStack"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.usage-plan.multikey": {
"stacks": [
"test-apigateway-usageplan-multikey"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigateway/test/integ.usage-plan.sharing": {
"stacks": [
"*"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigatewayv2-authorizers/test/http/integ.iam": {
"stacks": [
"IntegApiGatewayV2Iam"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigatewayv2-authorizers/test/http/integ.lambda": {
"stacks": [
"AuthorizerInteg"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "18.0.0",
"testCases": {
"aws-apigatewayv2-authorizers/test/http/integ.user-pool": {
"stacks": [
"AuthorizerInteg"
],
"diffAssets": false,
"stackUpdateWorkflow": true
}
},
"synthContext": {},
"enableLookups": false
}
Loading

0 comments on commit 721bd4b

Please sign in to comment.