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

New --exact-match option to "goss add command" to perform exact multi-line matches #947

Open
gberche-orange opened this issue Jul 10, 2024 · 1 comment

Comments

@gberche-orange
Copy link
Contributor

Describe the feature:

Enable goss add command to capture stdout/stderr as a multiline script

This enables to capture & then validate various multiline outputs that are sensitive to space and linefeed (typically yaml output).

This is useful in the test approach sometimes called golden master testing / approval testing/ Characterization tests
see https://en.wikipedia.org/wiki/Characterization_test

Here is a sample library that that supports such practice https://approvaltests.com/

Currently, the goss add command does a great job at capturing by default an array of trimmed strings to match. But this can not be used for approval testing commands that produce yaml.

Describe the solution you'd like

A new --exact-match option to "goss add command" to perform exact multi-line matches

Describe alternatives you've considered

wrap goss add with a script which would replace using yq the command.cmd.stdout

@aelsabbahy
Copy link
Member

Makes sense, marked as approved. I'll accept a PR implementing this. Can also be useful for the http check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants