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

Normalize CLI output / Simplify ExecuteCmd output handling in tests. #696

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

aricart
Copy link
Member

@aricart aricart commented Jan 5, 2025

This commit removes unused return values from ExecuteCmd calls, retaining only relevant ones such as out or err. It also adjusts related assertions and parsing logic to reflect this change, improving clarity and consistency across test files. This is an initial step towards normalizing where the CLI is outputting results looked at by tests.

This PR also fixes tests running under windows which were flappy depending on the amount of output returned by a command.

@aricart aricart changed the title Simplify ExecuteCmd output handling in tests. Normalize CLI output / Simplify ExecuteCmd output handling in tests. Jan 6, 2025
@aricart
Copy link
Member Author

aricart commented Jan 6, 2025

Fixes #580

… will now go to stdout if there is no error otherwise to stderr. Fixed commands to use fmt.Fprintf/variants to the right stream.

Fixes #580

[CI] Refactored test cases to modernize the use of `ExecuteCmd` to not use Pipes and simply provide io.Writer for test output collection. This solves spurious test failures in Windows

Signed-off-by: Alberto Ricart <[email protected]>
cmd/validate_test.go Show resolved Hide resolved
cmd/upgradejwt_test.go Show resolved Hide resolved
cmd/listkeys_test.go Outdated Show resolved Hide resolved
cmd/generatecreds.go Outdated Show resolved Hide resolved
cmd/describeuser.go Outdated Show resolved Hide resolved
cmd/describe.go Outdated Show resolved Hide resolved
…review

Correct variable naming from 'stderr' to 'stdout' in tests for clarity and fix inconsistent error return handling in commands. Ensure reliable behavior when writing or describing outputs across the codebase.

Signed-off-by: Alberto Ricart <[email protected]>
Copy link
Member

@MauriceVanVeen MauriceVanVeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aricart aricart merged commit 1760f0b into main Jan 8, 2025
11 checks passed
@aricart aricart deleted the test-out branch January 8, 2025 17:42
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.

2 participants