Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command empty strings #839

Merged
merged 5 commits into from
Sep 14, 2023
Merged

Command empty strings #839

merged 5 commits into from
Sep 14, 2023

Conversation

aelsabbahy
Copy link
Member

Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

Changed the behavior of goss add on a command, if the value of stdout or stderr is
empty, it will be defaulted to an empty string instead of an empty
array. The behavior remains unchanged when there is output; the value
will be an array.

This approach provides the following benefits:

  • Tests will fail if an empty string receives a value.
  • Arrays allows for simpler deletion of lines that are not relevant
    to the test assertion.

The idea behind this commit is to set the stage for adding aditional
logging metadata.
* Added new flags `--log-level` and `-l` to be consistent with other goss
flags.
  * `--loglevel` and `-L` will be deprecated in a future release
* Log level accepts any casing, so DEBUG and debug are both valid cli opts
* Add log level support for `add` and `autoadd` commands
Changed the behavior of `goss add` on a command, if the value of stdout or stderr is
empty, it will be defaulted to an empty string instead of an empty
array. The behavior remains unchanged when there is output; the value
will be an array.

This approach provides the following benefits:
* Tests will fail if an empty string receives a value.
* Arrays allows for simpler deletion of lines that are not relevant
to the test assertion.

closes #820
@aelsabbahy aelsabbahy merged commit b30f3fa into master Sep 14, 2023
1 check passed
@aelsabbahy aelsabbahy deleted the command_empty_strings branch September 14, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant