Skip to content

Commit

Permalink
chore(ec2): explicit feature flags to produce a consistent template d…
Browse files Browse the repository at this point in the history
…uring tests (aws#16008)

In v1, the default value of the `@aws-cdk/core:newStyleStackSynthesis` flag is `false`. As a consequence, `Template.fromStack()` generates, by default, a template without the rule and parameter related to bootstrap versions. In v2,  the default value of this flag is `true`. So this test fails in the v2 branch. By explicitly setting the flag to `false`, we ensure that the tests passes on both v1 and v2, regardless of the default values.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
madeline-k authored and hollanddd committed Aug 26, 2021
1 parent 618e81b commit 7dedea5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import '@aws-cdk/assert-internal/jest';
import { Stack } from '@aws-cdk/core';
import { App, Stack } from '@aws-cdk/core';
import { Connections, IClientVpnEndpoint } from '../lib';
import { ClientVpnAuthorizationRule } from '../lib/client-vpn-authorization-rule';

let stack: Stack;
beforeEach(() => {
stack = new Stack();
const app = new App({
context: {
'@aws-cdk/core:newStyleStackSynthesis': false,
},
});
stack = new Stack(app);
});

describe('ClientVpnAuthorizationRule constructor', () => {
Expand Down
9 changes: 7 additions & 2 deletions packages/@aws-cdk/aws-ec2/test/client-vpn-route.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import '@aws-cdk/assert-internal/jest';
import { SamlMetadataDocument, SamlProvider } from '@aws-cdk/aws-iam';
import { Stack } from '@aws-cdk/core';
import { App, Stack } from '@aws-cdk/core';
import * as ec2 from '../lib';
import {
ClientVpnRoute,
Expand All @@ -11,7 +11,12 @@ import {
let stack: Stack;
let vpc: ec2.IVpc;
beforeEach(() => {
stack = new Stack();
const app = new App({
context: {
'@aws-cdk/core:newStyleStackSynthesis': false,
},
});
stack = new Stack(app);
vpc = new ec2.Vpc(stack, 'Vpc');
});

Expand Down

0 comments on commit 7dedea5

Please sign in to comment.