kuttl icon indicating copy to clipboard operation
kuttl copied to clipboard

Support "shouldFail" for Command

Open gpaul opened this issue 5 years ago • 3 comments

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.

gpaul avatar Jun 25 '20 00:06 gpaul

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.

porridge avatar Jul 14 '20 11:07 porridge

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!

kensipe avatar Jul 17 '20 19:07 kensipe

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.

gpaul avatar Jul 18 '20 00:07 gpaul