From 1ed27bd550ba17758a1dba7b122cb26cf39cbbb2 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Thu, 3 Jul 2025 19:47:36 +0200 Subject: [PATCH] fix(integ-runner): snapshots involving AZs are different if `enableLookups: false` In https://github.com/aws/aws-cdk-cli/pull/666 we used `synthFast()` to always generate a snapshot in the same was as was used for validating (which was also using `synthFast()`). The difference being, that the context we load depends on the `enableLookups: false|true` flag that's passed to `new IntegTest()` in the test case itself. So when writing the snapshot we have to take that same field into account. --- packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts b/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts index c7a267142..25a106d36 100644 --- a/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts +++ b/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts @@ -326,11 +326,13 @@ export abstract class IntegRunner { fs.removeSync(this.snapshotDir); } + const actualTestSuite = await this.actualTestSuite(); + // if lookups are enabled then we need to synth again // using dummy context and save that as the snapshot await this.cdk.synthFast({ execCmd: this.cdkApp.split(' '), - context: this.getContext(DEFAULT_SYNTH_OPTIONS.context), + context: this.getContext(actualTestSuite.enableLookups ? DEFAULT_SYNTH_OPTIONS.context : {}), env: DEFAULT_SYNTH_OPTIONS.env, output: path.relative(this.directory, this.snapshotDir), });