Fix remaining misuses of capturing the default file descriptors in flytectl unit tests #5950
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.
Tracking issue
Closes #5937
Why are the changes needed?
#5325 didn't fix all the misuses of the capturing of stdout+stderr in unit tests. This PR fixes the remaining cases.
What changes were proposed in this pull request?
We add the teardown as a defer statement to all uses oftestutils.Setup
.Notice that in most cases we use barebones tests, which don't have a central place for setup/teardowns, so even though there's a comment explaining that
Teardown
has to be invoked, there's no automated way, at least to my knowledge, to do that.edit: as suggested by @Sovietaced , we can leverage the setup call to hookup the call to cleanup (to restore stdout and stderr).
How was this patch tested?
Confirmed that tests ran successfully Ran unit tests in a loop a few times:
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link