-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: introduce special logic for unit tests that rely on feature fl…
…ags (#12645) CDKv1 introduced feature flags that allowed users to opt-in to new backwards-incompatible behaviour. There are two types of flags - one set that need to be entirely removed in CDKv2 and their 'enabled' behaviour made the default, and another set where the the new behaviour should be made the default, and allow users to explicitly opt-out. This change addresses the testing strategy for the former set (and not the latter). There exist unit tests that test the behaviour both when the feature flags are enabled and feature flags and disabled. However, in v2, the feature flags will be removed and its usage blocked. The default behaviour will be as if the feature flag is enabled. Introduce branching logic that treats these unit tests depending on whether it's executed in the context of CDKv1 or CDKv2. The logic is as follows: - In the context of v1, all tests will execute as normal. - In the context of v2, tests that rely on feature flag to be unset will not be executed. - In the context of v2, tests that rely on feature flag to be set will not configure the feature flag on the App's context and continue to execute the test. This logic has been captured at a single location in two methods - `testFeatureFlag()` and `testFeatureFlagDisabled()`. To validate this logic, the unit tests that rely on the feature flags `aws-kms:defaultKeyPolicies`, `aws-secretsmanager:parseOwnedSecretName` and `core:enableStackNameDuplicates` have been updated to use these methods. Forward looking: The final PR in v2 is expected to look like this - #12644 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Niranjan Jayakar
authored
Jan 22, 2021
1 parent
26f1518
commit 31b1b32
Showing
5 changed files
with
247 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.