-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(integ-runner): test update path when running tests #19915
feat(integ-runner): test update path when running tests #19915
Conversation
This PR adds an "update path" workflow to the integration test workflow. When a change is being made to an existing integration test we want to be able to ensure that the change not only works for _new_ stacks, but also with _existing_ stacks. In order to accomplish this, the runner will first deploy the existing snapshot (i.e. `cdk deploy --app /path/to/snapshot`) and then perform a stack update by deploying the integration test. The update path can be disabled by passing the `--disable-update-path` command line option. This PR adds a couple of pieces of functionality in order to enable testing the "update path". 1. The runner will attempt to checkout the snapshot from the origin before running the test. This is to try and make sure that you are actually testing an update of the existing snapshot and not an intermediate snapshot (e.g. if you have been iterating locally). 2. When the runner performs the snapshot diff, it will check for any destructive changes and return that information as a warning to the user. 3. If any destructive changes are found, the runner will record that information as trace metadata in the `manifest.json` file. This will enable us to create automation that checks for this as part of the PR workflow
* This assumes that there is an 'origin'. `git remote show origin` returns a list of | ||
* all branches and we then search for one that starts with `HEAD branch: ` | ||
*/ | ||
private checkoutSnapshot(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when the snapshot hasn't been added to git yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm good question. Currently it will throw a warning saying it couldn't checkout the snapshot directory. I think it might be best to just add some info to the README about iterating on new tests, i.e. if you are working on a new test you should run with --disable-update-workflow
.
If it's a new test (snapshot hasn't been added to git) you shouldn't be using the update workflow. And I don't think there is a good way for us to automatically figure this out since you could have commited the snapshot and then run the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added section to readme.
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 PR adds an "update path" workflow to the integration test workflow. When a change is being made to an existing integration test we want to be able to ensure that the change not only works for _new_ stacks, but also with _existing_ stacks. In order to accomplish this, the runner will first deploy the existing snapshot (i.e. `cdk deploy --app /path/to/snapshot`) and then perform a stack update by deploying the integration test. The update path can be disabled by passing the `--disable-update-path` command line option. This PR adds a couple of pieces of functionality in order to enable testing the "update path". 1. The runner will attempt to checkout the snapshot from the origin before running the test. This is to try and make sure that you are actually testing an update of the existing snapshot and not an intermediate snapshot (e.g. if you have been iterating locally). 2. When the runner performs the snapshot diff, it will check for any destructive changes and return that information as a warning to the user. 3. If any destructive changes are found, the runner will record that information as trace metadata in the `manifest.json` file. This will enable us to create automation that checks for this as part of the PR workflow Added logic to include the `allowDestroy` option in items 2 & 3 above. If a resource type is included in the `allowDestroy` list, then it will not be reported. ---- ### 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*
This PR adds an "update path" workflow to the integration test
workflow. When a change is being made to an existing integration test we
want to be able to ensure that the change not only works for new
stacks, but also with existing stacks. In order to accomplish this,
the runner will first deploy the existing snapshot (i.e.
cdk deploy --app /path/to/snapshot
) and then perform a stack update by deployingthe integration test.
The update path can be disabled by passing the
--disable-update-path
command line option.
This PR adds a couple of pieces of functionality in order to enable
testing the "update path".
before running the test. This is to try and make sure that you are
actually testing an update of the existing snapshot and not an
intermediate snapshot (e.g. if you have been iterating locally).
destructive changes and return that information as a warning to the
user.
information as trace metadata in the
manifest.json
file. This willenable us to create automation that checks for this as part of the PR
workflow
Added logic to include the
allowDestroy
option in items 2 & 3 above.If a resource type is included in the
allowDestroy
list, thenit will not be reported.
All Submissions:
Adding new Unconventional Dependencies:
New Features
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