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:
Nicolas De Loof 2026-10-28 09:12:40 +01:00 • committed by Guillaume Lours
parent ac8b2cd44e
commit 79bd3ca73e

View file

@ -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.