Skip to content

Commit e256814

Browse files
authored
chore(cli-integ): ensure bootstrap on cli-lib tests (#33065)
The fixture wasn't ensuring a bootstrapped environment ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 498495a commit e256814

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ export class TestFixture extends ShellHelper {
634634
* Since we go striping across regions, it's going to suck doing this
635635
* by hand so let's just mass-automate it.
636636
*/
637-
async function ensureBootstrapped(fixture: TestFixture) {
637+
export async function ensureBootstrapped(fixture: TestFixture) {
638638
// Always use the modern bootstrap stack, otherwise we may get the error
639639
// "refusing to downgrade from version 7 to version 0" when bootstrapping with default
640640
// settings using a v1 CLI.

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import * as path from 'path';
33
import { TestContext } from './integ-test';
44
import { RESOURCES_DIR } from './resources';
55
import { AwsContext, withAws } from './with-aws';
6-
import { cloneDirectory, installNpmPackages, TestFixture, DEFAULT_TEST_TIMEOUT_S, CdkCliOptions } from './with-cdk-app';
6+
import { cloneDirectory, installNpmPackages, TestFixture, DEFAULT_TEST_TIMEOUT_S, CdkCliOptions, DisableBootstrapContext, ensureBootstrapped } from './with-cdk-app';
77
import { withTimeout } from './with-timeout';
88

99
/**
1010
* Higher order function to execute a block with a CliLib Integration CDK app fixture
1111
*/
12-
export function withCliLibIntegrationCdkApp<A extends TestContext & AwsContext>(block: (context: CliLibIntegrationTestFixture) => Promise<void>) {
12+
export function withCliLibIntegrationCdkApp<A extends TestContext & AwsContext & DisableBootstrapContext>(
13+
block: (context: CliLibIntegrationTestFixture) => Promise<void>) {
1314
return async (context: A) => {
1415
const randy = context.randomString;
1516
const stackNamePrefix = `cdktest-${randy}`;
@@ -44,6 +45,10 @@ export function withCliLibIntegrationCdkApp<A extends TestContext & AwsContext>(
4445
'constructs': '^10',
4546
});
4647

48+
if (!context.disableBootstrap) {
49+
await ensureBootstrapped(fixture);
50+
}
51+
4752
await block(fixture);
4853
} catch (e: any) {
4954
// We survive certain cases involving gopkg.in
@@ -132,3 +137,4 @@ __EOS__`], {
132137
}
133138

134139
}
140+

0 commit comments

Comments
 (0)