-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix help message flags on docker stack commands and sub-commands #1251
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package stack | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "testing" | ||
|
|
||
| "gotest.tools/golden" | ||
| "gotest.tools/icmd" | ||
| ) | ||
|
|
||
| func TestStackDeployHelp(t *testing.T) { | ||
| t.Run("Swarm", func(t *testing.T) { | ||
| testStackDeployHelp(t, "swarm") | ||
| }) | ||
| t.Run("Kubernetes", func(t *testing.T) { | ||
| testStackDeployHelp(t, "kubernetes") | ||
| }) | ||
| } | ||
|
|
||
| func testStackDeployHelp(t *testing.T, orchestrator string) { | ||
| result := icmd.RunCommand("docker", "stack", "deploy", "--orchestrator", orchestrator, "--help") | ||
| result.Assert(t, icmd.Success) | ||
| golden.Assert(t, result.Stdout(), fmt.Sprintf("stack-deploy-help-%s.golden", orchestrator)) | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
|
|
||
| Usage: docker stack deploy [OPTIONS] STACK | ||
|
|
||
| Deploy a new stack or update an existing stack | ||
|
|
||
| Aliases: | ||
| deploy, up | ||
|
|
||
| Options: | ||
| -c, --compose-file strings Path to a Compose file, or "-" to read | ||
| from stdin | ||
| --kubeconfig string Kubernetes config file | ||
| --namespace string Kubernetes namespace to use | ||
| --orchestrator string Orchestrator to use (swarm|kubernetes|all) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
|
|
||
| Usage: docker stack deploy [OPTIONS] STACK | ||
|
|
||
| Deploy a new stack or update an existing stack | ||
|
|
||
| Aliases: | ||
| deploy, up | ||
|
|
||
| Options: | ||
| --bundle-file string Path to a Distributed Application Bundle file | ||
| -c, --compose-file strings Path to a Compose file, or "-" to read | ||
| from stdin | ||
| --orchestrator string Orchestrator to use (swarm|kubernetes|all) | ||
| --prune Prune services that are no longer referenced | ||
| --resolve-image string Query the registry to resolve image digest | ||
| and supported platforms | ||
| ("always"|"changed"|"never") (default "always") | ||
| --with-registry-auth Send registry authentication details to | ||
| Swarm agents |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the commonly used way to verify command outputs in this project? This will break every time an option or help message is added/modified, this producing unnecessary maintenance work.
Alternatively, we could check for the presence of specific flags via substring checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albers I think it's safe to "break every time" on that command as we don't often change those, and if we do well, the test is easily fixable (
go test -updateor sthg like that). I do agree it's not ideal though, but 😅