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

refactor test command to add a test #186

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

jakecoffman
Copy link
Member

Refactored the flags into a struct and added a NewTestCommand to allow for testing of the RunE command.

Initially we followed the Cobra pattern of using a package-level var block to initialize flags, but that led to functions operating on variables that weren't parameters to the function. Now by passing a flag struct around we can write more tests without worrying about "global" state.

Also the amount of flags has slowly grown, so having them all together in a struct is handy. In a future refactor we might push those flags down into the infra package to avoid having to copy them over into the nebulous infra.Params.

@jakecoffman jakecoffman requested a review from a team as a code owner October 27, 2023 17:25
@jakecoffman jakecoffman enabled auto-merge (squash) October 27, 2023 17:29
@jakecoffman jakecoffman disabled auto-merge November 8, 2023 15:06
@jakecoffman jakecoffman merged commit 90d144b into main Nov 8, 2023
41 checks passed
@jakecoffman jakecoffman deleted the jakecoffman/refactor-to-add-test-part-deux branch November 8, 2023 18:52
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