This repository was archived by the owner on Oct 6, 2025. It is now read-only.
Add mocks and UTs for docker model status#20
Merged
doringeman merged 3 commits intodocker:mainfrom Apr 8, 2025
Merged
Conversation
Collaborator
doringeman
commented
Apr 7, 2025
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
ilopezluna
approved these changes
Apr 7, 2025
| cmd.Println("Docker Model Runner is not running") | ||
| hooks.PrintNextSteps(os.Stdout, []string{enableViaCLI, enableViaGUI}) | ||
| os.Exit(1) | ||
| hooks.PrintNextSteps(cmd.OutOrStdout(), []string{enableViaCLI, enableViaGUI}) |
Contributor
There was a problem hiding this comment.
why cmd.OutOrStdout() instead of os.Stdout? Also why to extract os.Exit into a variable?
I assume it has to do with being able to assert the output in the test but I'm unsure of how it works.
Collaborator
Author
There was a problem hiding this comment.
So I can capture it in the UT where I overwrite cmd's output.
https://github.com/docker/model-cli/pull/20/files/d706eeb6e5433e561bc3e661066ef3a1cfe07bd4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.