feat: Add portability to command invocation unit tests #3758
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what
Add a switch to detect the use of GOOS of darwin, then change the expected output for certain commands that call
exec.Command()
.why
Right now on
main
runningmake test
causes a bunch of verbose errors (see below). Runningmake docker/test
had all tests pass (still the case with this change), it's just that the/bin/sh
has slightly different output based on operating system.It's possible (probable) that other OSs (or operating system versions? Maybe even distros for linux?) will have still other outputs that need to be handled. I haven't attempted to address that, and tests will still fail in those cases, but this will give users a hint of how they could add code to fix for their
sh
commands.tests
Before:
After:
references