From c274c2f983de2dfd20ed2886a3c50f7fd3f6b3f4 Mon Sep 17 00:00:00 2001 From: Cory Hall <43035978+corymhall@users.noreply.github.com> Date: Fri, 27 May 2022 09:32:37 -0400 Subject: [PATCH] fix(integ-runner): don't throw error if tests pass (#20511) If you run `integ-runner --update-on-failed` and the test succeeds, then the cli should not return an exit code. re #20384 ---- ### 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 `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* --- packages/@aws-cdk/integ-runner/lib/cli.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/integ-runner/lib/cli.ts b/packages/@aws-cdk/integ-runner/lib/cli.ts index 1c7c7920375d5..6014d4997378a 100644 --- a/packages/@aws-cdk/integ-runner/lib/cli.ts +++ b/packages/@aws-cdk/integ-runner/lib/cli.ts @@ -49,9 +49,10 @@ async function main() { let failedSnapshots: IntegTestWorkerConfig[] = []; if (argv['max-workers'] < testRegions.length * (profiles ?? [1]).length) { - logger.warning('You are attempting to run %s tests in parallel, but only have %s workers. Not all of your profiles+regions will be utilized', argv.profiles*argv['parallel-regions'], argv['max-workers']); + logger.warning('You are attempting to run %s tests in parallel, but only have %s workers. Not all of your profiles+regions will be utilized', argv.profiles * argv['parallel-regions'], argv['max-workers']); } + let testsSucceeded = false; try { if (argv.list) { const tests = await new IntegrationTests(argv.directory).fromCliArgs(); @@ -99,6 +100,8 @@ async function main() { verbose: argv.verbose, updateWorkflow: !argv['disable-update-workflow'], }); + testsSucceeded = success; + if (argv.clean === false) { logger.warning('Not cleaning up stacks since "--no-clean" was used'); @@ -125,7 +128,9 @@ async function main() { if (!runUpdateOnFailed) { message = 'To re-run failed tests run: yarn integ-runner --update-on-failed'; } - throw new Error(`Some snapshot tests failed!\n${message}`); + if (!testsSucceeded) { + throw new Error(`Some tests failed!\n${message}`); + } } }