mirror of https://github.com/docker/docs.git
Merge pull request #736 from shawnzhu/tlsverify-flag
uses --tlsverify instead of --tls in config output
This commit is contained in:
commit
7404e4d3ff
|
@ -369,7 +369,7 @@ func cmdConfig(c *cli.Context) {
|
|||
|
||||
dockerHost = fmt.Sprintf("tcp://%s:%s", machineIp, swarmPort)
|
||||
}
|
||||
fmt.Printf("--tls --tlscacert=%s --tlscert=%s --tlskey=%s -H=%s",
|
||||
fmt.Printf("--tlsverify --tlscacert=%s --tlscert=%s --tlskey=%s -H=%s",
|
||||
cfg.caCertPath, cfg.clientCertPath, cfg.clientKeyPath, dockerHost)
|
||||
}
|
||||
|
||||
|
|
|
@ -300,14 +300,13 @@ func TestRunActionForeachMachine(t *testing.T) {
|
|||
func TestCmdConfig(t *testing.T) {
|
||||
stdout := os.Stdout
|
||||
r, w, _ := os.Pipe()
|
||||
os.Stdout = w
|
||||
|
||||
os.Stdout = w
|
||||
os.Setenv("MACHINE_STORAGE_PATH", TestStoreDir)
|
||||
|
||||
defer func() {
|
||||
os.Setenv("MACHINE_STORAGE_PATH", "")
|
||||
os.Stdout = stdout
|
||||
w.Close()
|
||||
}()
|
||||
|
||||
if err := clearHosts(); err != nil {
|
||||
|
@ -333,17 +332,27 @@ func TestCmdConfig(t *testing.T) {
|
|||
t.Fatalf("error setting active host: %v", err)
|
||||
}
|
||||
|
||||
outStr := make(chan string)
|
||||
|
||||
go func() {
|
||||
var testOutput bytes.Buffer
|
||||
io.Copy(&testOutput, r)
|
||||
outStr <- testOutput.String()
|
||||
}()
|
||||
|
||||
set := flag.NewFlagSet("config", 0)
|
||||
|
||||
testOutput := &bytes.Buffer{}
|
||||
|
||||
go io.Copy(testOutput, r)
|
||||
|
||||
c := cli.NewContext(nil, set, set)
|
||||
|
||||
cmdConfig(c)
|
||||
|
||||
if strings.Contains(testOutput.String(), "-H=unix:///var/run/docker.sock") {
|
||||
w.Close()
|
||||
|
||||
out := <-outStr
|
||||
|
||||
if !strings.Contains(out, "--tlsverify") {
|
||||
t.Fatalf("Expect --tlsverify")
|
||||
}
|
||||
|
||||
if !strings.Contains(out, "-H=unix:///var/run/docker.sock") {
|
||||
t.Fatalf("Expect docker host URL")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue