mirror of https://github.com/docker/cli.git
e2e: Add a TestMain for cli plugins tests
This was omitted when these tests were added. Adding this means that the tests now see the `$DOCKER_HOST` configured (via `$TEST_DOCKER_HOST`) where they didn't before. In some cases (specifically the `test-e2e-connhelper-ssh` case) this results in additional output on stderr when `-D` (debug) is used: time="2019-04-03T11:10:27Z" level=debug msg="commandconn: starting ssh with [-l penguin 172.20.0.2 -- docker system dial-stdio]" Address this by switching the affected test cases to use `-l info` instead of `-D`, they all just require some option not specifically `-D`. Note that `info` is the default log level so this is effectively a nop (which is good). Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
add2da66c5
commit
ef40743669
|
@ -0,0 +1,17 @@
|
||||||
|
package cliplugins
|
||||||
|
|
||||||
|
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())
|
||||||
|
}
|
|
@ -135,7 +135,7 @@ func TestHelpGood(t *testing.T) {
|
||||||
run, _, cleanup := prepare(t)
|
run, _, cleanup := prepare(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
res := icmd.RunCmd(run("-D", "help", "helloworld"))
|
res := icmd.RunCmd(run("-l", "info", "help", "helloworld"))
|
||||||
res.Assert(t, icmd.Expected{
|
res.Assert(t, icmd.Expected{
|
||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
Err: icmd.None,
|
Err: icmd.None,
|
||||||
|
@ -150,7 +150,7 @@ func TestGoodHelp(t *testing.T) {
|
||||||
run, _, cleanup := prepare(t)
|
run, _, cleanup := prepare(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
res := icmd.RunCmd(run("-D", "helloworld", "--help"))
|
res := icmd.RunCmd(run("-l", "info", "helloworld", "--help"))
|
||||||
res.Assert(t, icmd.Expected{
|
res.Assert(t, icmd.Expected{
|
||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
Err: icmd.None,
|
Err: icmd.None,
|
||||||
|
@ -159,7 +159,7 @@ func TestGoodHelp(t *testing.T) {
|
||||||
golden.Assert(t, res.Stdout(), "docker-help-helloworld.golden")
|
golden.Assert(t, res.Stdout(), "docker-help-helloworld.golden")
|
||||||
// Short -h should be the same, modulo the deprecation message
|
// Short -h should be the same, modulo the deprecation message
|
||||||
exp := shortHFlagDeprecated + res.Stdout()
|
exp := shortHFlagDeprecated + res.Stdout()
|
||||||
res = icmd.RunCmd(run("-D", "helloworld", "-h"))
|
res = icmd.RunCmd(run("-l", "info", "helloworld", "-h"))
|
||||||
res.Assert(t, icmd.Expected{
|
res.Assert(t, icmd.Expected{
|
||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
// This should be identical to the --help case above
|
// This should be identical to the --help case above
|
||||||
|
@ -188,7 +188,7 @@ func TestHelpGoodSubcommand(t *testing.T) {
|
||||||
run, _, cleanup := prepare(t)
|
run, _, cleanup := prepare(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
res := icmd.RunCmd(run("-D", "help", "helloworld", "goodbye"))
|
res := icmd.RunCmd(run("-l", "info", "help", "helloworld", "goodbye"))
|
||||||
res.Assert(t, icmd.Expected{
|
res.Assert(t, icmd.Expected{
|
||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
Err: icmd.None,
|
Err: icmd.None,
|
||||||
|
@ -203,7 +203,7 @@ func TestGoodSubcommandHelp(t *testing.T) {
|
||||||
run, _, cleanup := prepare(t)
|
run, _, cleanup := prepare(t)
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
res := icmd.RunCmd(run("-D", "helloworld", "goodbye", "--help"))
|
res := icmd.RunCmd(run("-l", "info", "helloworld", "goodbye", "--help"))
|
||||||
res.Assert(t, icmd.Expected{
|
res.Assert(t, icmd.Expected{
|
||||||
ExitCode: 0,
|
ExitCode: 0,
|
||||||
Err: icmd.None,
|
Err: icmd.None,
|
||||||
|
|
Loading…
Reference in New Issue