Support "shouldFail" for Command
What would you like to be added:
Add "shouldFail" to the v1beta1.command type.
Why is this needed: I'd like to confirm that executing a certain command fails.
A command can fail in many ways - with certain error codes or terminated by a number of signals. Perhaps we should think of an interface that supports this, like a expectedExitCode (default 0) that we could match against the exit code?
Although then asserting any non-zero exit code would be difficult.
I'll group this in the "theme" of commands asserts... which has a number of concerns beyond what @porridge mentions. (thanks Marcin!). I will target this "theme" of activity for v0.7.0 which is an iteration away.
@gpaul more clarity for your use-case based on marcins comments would be great.
In fact, if you could provide a mock configuration and what your expectations around that would be really great!
Maybe something like
apiVersion: kudo.dev/v1alpha1
kind: TestStep
commands:
- command: ../../bin/dispatch login github --user=test --password=test
# Test that duplicate login fails.
- command: ../../bin/dispatch login github --user=test --password=test
expectedExitCode: 1
This is the problem I was trying to test, by the way.