Fix help message flags on docker stack commands and sub-commands
PersistentPreRunE needs to be called within the help function to initialize all the flags (notably the orchestrator flag) Add an e2e test as regression test Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
24
e2e/stack/help_test.go
Normal file
24
e2e/stack/help_test.go
Normal file
@ -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))
|
||||
}
|
||||
Reference in New Issue
Block a user