Skip to content

Commit

Permalink
chore: integ test trying to downgrade bootstrap stack (aws#17298)
Browse files Browse the repository at this point in the history
This is a follow-up to aws#17277: we switched to *always* bootstrapping
the environment using the default settings, to automatically upgrade
whenever an upgrade was available.

However, if we run the integ test using a v1 CLI, the default bootstrap
stack will be the legacy bootstrap, and we would actually be trying
to *downgrade* it. Instead, always use the modern bootstrap stack.

Since legacy apps can be deployed to the modern bootstrap stack, this
is not an issue, and if a test actually needs the legacy stack to test
something, it will explicitly try to create a fresh legacy bootstrap
stack.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
rix0rrr authored and TikiTDO committed Feb 21, 2022
1 parent 3f75c44 commit 78bd849
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/aws-cdk/test/integ/helpers/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,21 @@ let sanityChecked: boolean | undefined;
* by hand so let's just mass-automate it.
*/
async function ensureBootstrapped(fixture: TestFixture) {
// use whatever version of bootstrap is the default for this particular version of the CLI
// Always use the modern bootstrap stack, otherwise we may get the error
// "refusing to downgrade from version 7 to version 0" when bootstrapping with default
// settings using a v1 CLI.
//
// It doesn't matter for tests: when they want to test something about an actual legacy
// bootstrap stack, they'll create a bootstrap stack with a non-default name to test that exact property.
const envSpecifier = `aws://${await fixture.aws.account()}/${fixture.aws.region}`;
if (ALREADY_BOOTSTRAPPED_IN_THIS_RUN.has(envSpecifier)) { return; }

await fixture.cdk(['bootstrap', envSpecifier]);
await fixture.cdk(['bootstrap', envSpecifier], {
modEnv: {
// Even for v1, use new bootstrap
CDK_NEW_BOOTSTRAP: '1',
},
});
ALREADY_BOOTSTRAPPED_IN_THIS_RUN.add(envSpecifier);
}

Expand Down

0 comments on commit 78bd849

Please sign in to comment.