keep using --tlsverify between config and env commands

Signed-off-by: Ke Zhu <kzhu@us.ibm.com>
This commit is contained in:
Ke Zhu
2015-03-06 14:23:16 -05:00
parent 5b81fde44a
commit 1bb4b95110
2 changed files with 19 additions and 10 deletions

View File

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

View File

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