-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e: add new test package "global" with TestTLSVerify
Signed-off-by: Tibor Vass <tibor@docker.com>
- Loading branch information
Tibor Vass
committed
Nov 12, 2019
1 parent
37f9a88
commit a005f3a
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package global | ||
|
||
import ( | ||
"testing" | ||
|
||
"gotest.tools/skip" | ||
"gotest.tools/icmd" | ||
"github.com/docker/cli/internal/test/environment" | ||
) | ||
|
||
func TestTLSVerify(t *testing.T) { | ||
// Remote daemons use TLS and this test is not applicable when TLS is required. | ||
skip.If(t, environment.RemoteDaemon()) | ||
|
||
icmd.RunCmd(icmd.Command("docker", "ps")).Assert(t, icmd.Success) | ||
|
||
// Regardless of whether we specify true or false we need to | ||
// test to make sure tls is turned on if --tlsverify is specified at all | ||
result := icmd.RunCmd(icmd.Command("docker", "--tlsverify=false", "ps")) | ||
result.Assert(t, icmd.Expected{ExitCode: 1, Err: "unable to resolve docker endpoint:"}) | ||
|
||
result = icmd.RunCmd(icmd.Command("docker", "--tlsverify=true", "ps")) | ||
result.Assert(t, icmd.Expected{ExitCode: 1, Err: "ca.pem"}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package global | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
"github.com/docker/cli/internal/test/environment" | ||
) | ||
|
||
func TestMain(m *testing.M) { | ||
if err := environment.Setup(); err != nil { | ||
fmt.Println(err.Error()) | ||
os.Exit(3) | ||
} | ||
os.Exit(m.Run()) | ||
} |