Files
docker-cli/e2e/stack/help_test.go
Silvin Lubecki 21cce52b30 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>
2018-08-01 01:48:27 +02:00

25 lines
581 B
Go

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))
}