Skip to content

Commit 5fa3b0f

Browse files
authored
fix: limit SAR application test to regions that have SAR enabled, plus simplification for docker asset test (#2096)
Fixes test runs that try to deploy a SAR resource to regions that don't support them. Supported regions are documented here: https://docs.aws.amazon.com/general/latest/gr/serverlessrepo.html. It also removes logic from `packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/deploy/cdk-deploy-docker-asset-multi-region.integtest.ts` that depends on `process.env.AWS_REGIONS`, which isn't set in Atmosphere-enabled runs. This precedes an API change in an internal repo. ### Checklist - [ ] This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed - Release notes for the new version: --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent f9172c7 commit 5fa3b0f

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎packages/@aws-cdk-testing/cli-integ/lib/regions.ts‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,33 @@ export function allBut(exclude: string[]): string[] {
4343
}
4444

4545
/**
46-
* Regions that don't support CloudFormation Stack Refactoring
46+
* Regions that support CloudFormation Stack Refactoring
4747
*/
4848
export const STACK_REFACTORING_REGIONS = allBut([
49+
// Unsupported regions
4950
'ap-southeast-5',
5051
'ap-southeast-7',
5152
'mx-central-1',
5253
]);
5354

55+
/**
56+
* Regions that support the Serverless Application Repository
57+
*
58+
* @see https://docs.aws.amazon.com/general/latest/gr/serverlessrepo.html
59+
*/
60+
export const SAR_REGIONS = allBut([
61+
// Unsupported regions
62+
'ap-northeast-3',
63+
'af-south-1',
64+
'ap-south-2',
65+
'ap-southeast-3',
66+
'ap-southeast-4',
67+
'ap-southeast-5',
68+
'ap-southeast-7',
69+
'eu-central-2',
70+
'eu-south-1',
71+
'eu-south-2',
72+
'il-central-1',
73+
'ca-west-1',
74+
'mx-central-1',
75+
]);

‎packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/deploy/cdk-deploy-docker-asset-multi-region.integtest.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ integTest(
44
'deploy same docker asset to multiple regions',
55
withDefaultFixture(async (fixture) => {
66
const primaryRegion = fixture.aws.region;
7-
const availableRegions = (process.env.AWS_REGIONS ?? 'us-east-1,us-west-2').split(',');
8-
const secondaryRegion = availableRegions.find((r) => r !== primaryRegion) ?? 'us-west-2';
7+
const secondaryRegion = ['us-east-1', 'us-west-2'].find((r) => r !== primaryRegion)!;
98

109
// Bootstrap the secondary region (with the same random qualifier the app
1110
// is synthesized with, and a unique stack name to avoid clashing with

‎packages/@aws-cdk-testing/cli-integ/tests/cli-integ-tests/diff/cdk-diff---method-change-set-does-not-show-templateurl-change-for-sar-application.integtest.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { integTest, withSpecificFixture } from '../../../lib';
2+
import { SAR_REGIONS } from '../../../lib/regions';
23

34
/**
45
* Regression test for https://github.com/aws/aws-cdk-cli/issues/2025
@@ -21,5 +22,5 @@ integTest(
2122
// THEN
2223
expect(diff).not.toContain('TemplateURL');
2324
expect(diff).toContain('There were no differences');
24-
}),
25+
}, { aws: { regions: SAR_REGIONS } }),
2526
);

0 commit comments

Comments
 (0)