Skip to content

Commit b1a43a2

Browse files
authored
chore: fix all integ tests (#22821)
Currently, many (all?) our integ tests fail _deployment_ with ``` Error: Resolution error: Resolution error: Resolution error: Resolution error: Context value '@aws-cdk/core:target-partitions' should be a list of strings, got: '@aws-cdk/core:target-partitions'. ``` This is a result of #22771, which introduced `[TARGET_PARTITIONS]: undefined,` to the `this.getContext()` method in the integ runner. However, the integ runner stringifies all context in a few places like [here](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts#L335). That makes the value of `TARGET_PARTITIONS = 'undefined'`. The error message also fails to provide a decent understanding of what's going on, due to a typo that this PR also fixes. This fix fixes the integ test I was trying to run. ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/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/main/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*
1 parent c6d250f commit b1a43a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/@aws-cdk/core/lib/stack.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,8 @@ export class Stack extends Construct implements ITaggable {
870870
}
871871

872872
const partitions = Node.of(this).tryGetContext(cxapi.TARGET_PARTITIONS);
873-
if (partitions !== undefined && !Array.isArray(partitions)) {
874-
throw new Error(`Context value '${cxapi.TARGET_PARTITIONS}' should be a list of strings, got: ${JSON.stringify(cxapi.TARGET_PARTITIONS)}`);
873+
if (partitions !== undefined && partitions !== 'undefined' && !Array.isArray(partitions)) {
874+
throw new Error(`Context value '${cxapi.TARGET_PARTITIONS}' should be a list of strings, got: ${JSON.stringify(partitions)}`);
875875
}
876876

877877
const lookupMap = partitions ? RegionInfo.limitedRegionMap(factName, partitions) : RegionInfo.regionMap(factName);

0 commit comments

Comments
 (0)