Conversation
| begin | ||
| result = StackMaster::CLI.new(ARGV.dup).execute! | ||
| exit !!result | ||
| StackMaster::CLI.new(ARGV.dup).execute! |
There was a problem hiding this comment.
This binstub no longer handles the exit status.
| end | ||
| end | ||
| success | ||
| @kernel.exit false unless success |
There was a problem hiding this comment.
The CLI class now handles the exit status.
| Feature: Check the StackMaster version | ||
| Scenario: Use the --version option | ||
| When I run `stack_master --version` | ||
| Then the exit status should be 0 |
There was a problem hiding this comment.
Add a scenario to ensure stack_master --version results in a 0 status.
| | + "Vpc": { | | ||
| | Parameters diff: | | ||
| | KeyName: my-key | | ||
| And the exit status should be 0 |
There was a problem hiding this comment.
Validate the exit status in all Cucumber scenarios.
| And the output should contain all of these lines: | ||
| | Account '11111111' is not an allowed account. Allowed accounts are ["22222222"].| | ||
| Then the exit status should be 0 | ||
| Then the exit status should be 1 |
There was a problem hiding this comment.
This is an example of an incorrect Cucumber validation. This scenario was ensuring a status 0, but because it was only testing via the CLI class it missed the binstub returning 1.
Now the feature correctly checks the value returned in the command invocation.
Note: this is not a change in StackMaster behaviour.
patrobinson
left a comment
There was a problem hiding this comment.
💯
This is something we've had a number of regressions in before.
Context
There are a couple of peculiar StackMaster behaviours regarding exit status.
stack_master --versionresults in a status of1(stack_master --version returns a failed exit code #183).stack_masterbinstub, but the Cucumber feature suite doesn't test this. It drives StackMaster via theStackMaster::CLIclass directly. This makes validating the status code impossible.Change
I propose we move handling of the exit status into the
StackMaster::CLIclass. This will solve both problems:stack_master --versionwill return a status of0(fixes stack_master --version returns a failed exit code #183).