-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWSParameterStore - Support Global Parameters #302
Conversation
codezninja
commented
Sep 16, 2020
- add support for global parameters
TODO
|
Codecov Report
@@ Coverage Diff @@
## master #302 +/- ##
==========================================
+ Coverage 78.43% 78.98% +0.54%
==========================================
Files 41 41
Lines 1048 1061 +13
Branches 244 247 +3
==========================================
+ Hits 822 838 +16
+ Misses 105 99 -6
- Partials 121 124 +3
Continue to review full report at Codecov.
|
* upstream/master: Trim whitespace and fix unit test Introduce a failing test to detect the problem Update changelog
def result = ParameterStoreBuildWrapperPlugin.withGlobalParameter('/path/', [recursive: true, basename: 'relative']) | ||
|
||
assertEquals([[path: '/path/', recursive: true, basename: 'relative']], result.globalParameterOptions) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this test. It shows that you can call addGlobalParameters
with or without options.
Code coverage is going down because the Let's tackle that by first creating contexts for apply in our test suites. Since we have 2 apply's - one for TerraformValidateStage and another for TerraformEnvironmentStage - let's create an "ApplyForTerraformValidateStage" context, and a "ApplyForTerraformEnvironmentStage" context, so that each method can be unit tested separately. You can see this sort of pattern here - https://github.com/manheim/terraform-pipeline/blob/master/test/TagPluginTest.groovy#L114 Looking at the behavior of
To sketch out what that might look like in code:
Zooming in on what addsNoDecorationWhenThereAreNoGlobalParameters might test, I think I'd setup a
Zooming in on what addsADecorationForEachParameter might test, I think I'd setup a
^-- taking the above, I could follow a similar process for "ApplyForTerraformEnvironmentStage". Looking at the implementation of that method, there's slightly more behavior. There's everything that's done to ValidateStage, and then some.
Each of those 5 behaviors could potentially be tested through a distinct unit test. If you wanted to limit the scope of tests to just what you changed, you could focus on tests 1, 2, 3, and say that 4 and 5 should have already been tested prior to your change. |
Awesome! Thanks for the contribution, this feels like a super useful feature! |