Skip to content

goss add command to set default assertions for empty stdout/stderr #820

@gberche-orange

Description

@gberche-orange

Describe the feature:

As a goss user,
In order to detect non expected stderr/stdout messages in command output
I need the goss add command to set assertions when observed stdout/stderr are empty

For instance, if a binary is missing from the test environment and stderr includes "command not found", I'd need the stderr assert to fail

Describe the solution you'd like

A way to assert empty stdout/stderr similar to #184

And this syntax should be used by default in goss.yaml when the goss add command observes empty stdout/stderr

Describe alternatives you've considered

I tried using rexexp to check empty strings such as:

command:
  # the sleep command produces no stdout or stderr
  sleep 1s:
    exit-status: 0
    stdout: [] # this syntax seems to always succeed, regarless of whether output is sent to stdout
    stderr: [ "/^$/" ] # this syntax seems to always fail, whereas no output to stderr should pass test
    timeout: 10000

however goss isn't yet failing this assertion:

$ goss validate
.F

Failures/Skipped:

Command: sleep 1s: stderr: patterns not found: [/^$/]

Total Duration: 1.006s
Count: 2, Failed: 1, Skipped: 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions