github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/e2e/global/cli_test.go (about) 1 package global 2 3 import ( 4 "testing" 5 6 "github.com/docker/cli/internal/test/environment" 7 "gotest.tools/v3/icmd" 8 "gotest.tools/v3/skip" 9 ) 10 11 func TestTLSVerify(t *testing.T) { 12 // Remote daemons use TLS and this test is not applicable when TLS is required. 13 skip.If(t, environment.RemoteDaemon()) 14 15 icmd.RunCmd(icmd.Command("docker", "ps")).Assert(t, icmd.Success) 16 17 // Regardless of whether we specify true or false we need to 18 // test to make sure tls is turned on if --tlsverify is specified at all 19 result := icmd.RunCmd(icmd.Command("docker", "--tlsverify=false", "ps")) 20 result.Assert(t, icmd.Expected{ExitCode: 1, Err: "unable to resolve docker endpoint:"}) 21 22 result = icmd.RunCmd(icmd.Command("docker", "--tlsverify=true", "ps")) 23 result.Assert(t, icmd.Expected{ExitCode: 1, Err: "ca.pem"}) 24 }