mirror of
https://github.com/docker/compose.git
synced 2026-11-17 13:45:39 +00:00
test(e2e): add StdoutEmpty check
A command that is a no-op (e.g. start on an already running service) must stay silent on stdout. The legacy tests asserted it by hand; expose it as a generic observable of the scenario vocabulary. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
ac8b2cd44e
commit
79bd3ca73e
1 changed files with 14 additions and 0 deletions
|
|
@ -151,6 +151,20 @@ func OutputNotContains(sub string) Check {
|
|||
}
|
||||
}
|
||||
|
||||
// StdoutEmpty expects the command to have written nothing to stdout, for
|
||||
// commands that must stay silent on a no-op (progress goes to stderr).
|
||||
func StdoutEmpty() Check {
|
||||
return Check{
|
||||
name: "stdout is empty",
|
||||
fn: func(ctx *CheckContext) error {
|
||||
if out := ctx.result.Stdout(); out != "" {
|
||||
return fmt.Errorf("unexpected stdout: %q", out)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ExitCode expects the step's command to have exited with the given code.
|
||||
// Only meaningful on a MayFail action: without MayFail, any non-zero exit
|
||||
// already fails the step before checks run.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue