From bb8e1dc8fa7bda27592b140b433b5ffabdb44917 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 24 Dec 2015 16:18:23 +0100 Subject: [PATCH] integration-cli: fix --net=none build Signed-off-by: Antonio Murdaca --- integration-cli/docker_cli_authz_unix_test.go | 16 +++++++++------- integration-cli/docker_cli_info_test.go | 2 +- integration-cli/docker_utils.go | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/integration-cli/docker_cli_authz_unix_test.go b/integration-cli/docker_cli_authz_unix_test.go index 6fab8b02c8..92b4a19b63 100644 --- a/integration-cli/docker_cli_authz_unix_test.go +++ b/integration-cli/docker_cli_authz_unix_test.go @@ -136,7 +136,6 @@ func assertAuthHeaders(c *check.C, headers map[string]string) error { // assertBody asserts that body is removed for non text/json requests func assertBody(c *check.C, requestURI string, headers map[string]string, body []byte) { - if strings.Contains(strings.ToLower(requestURI), "auth") && len(body) > 0 { //return fmt.Errorf("Body included for authentication endpoint %s", string(body)) c.Errorf("Body included for authentication endpoint %s", string(body)) @@ -164,18 +163,21 @@ func (s *DockerAuthzSuite) TearDownSuite(c *check.C) { } func (s *DockerAuthzSuite) TestAuthZPluginAllowRequest(c *check.C) { - err := s.d.Start("--authz-plugin=" + testAuthZPlugin) - c.Assert(err, check.IsNil) + // start the daemon and load busybox, --net=none build fails otherwise + // cause it needs to pull busybox + c.Assert(s.d.StartWithBusybox(), check.IsNil) + // restart the daemon and enable the plugin, otherwise busybox loading + // is blocked by the plugin itself + c.Assert(s.d.Restart("--authz-plugin="+testAuthZPlugin), check.IsNil) + s.ctrl.reqRes.Allow = true s.ctrl.resRes.Allow = true // Ensure command successful - out, err := s.d.Cmd("run", "-d", "--name", "container1", "busybox:latest", "top") + out, err := s.d.Cmd("run", "-d", "busybox", "top") c.Assert(err, check.IsNil) - // Extract the id of the created container - res := strings.Split(strings.TrimSpace(out), "\n") - id := res[len(res)-1] + id := strings.TrimSpace(out) assertURIRecorded(c, s.ctrl.requestsURIs, "/containers/create") assertURIRecorded(c, s.ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", id)) diff --git a/integration-cli/docker_cli_info_test.go b/integration-cli/docker_cli_info_test.go index 1eb090ad8f..232e4131f9 100644 --- a/integration-cli/docker_cli_info_test.go +++ b/integration-cli/docker_cli_info_test.go @@ -78,7 +78,7 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) { // TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise` // configured with interface name properly show the advertise ip-address in info output. func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) { - testRequires(c, SameHostDaemon) + testRequires(c, SameHostDaemon, Network) d := NewDaemon(c) discoveryBackend := "consul://consuladdr:consulport/some/path" diff --git a/integration-cli/docker_utils.go b/integration-cli/docker_utils.go index c40a52931d..01a2811ebd 100644 --- a/integration-cli/docker_utils.go +++ b/integration-cli/docker_utils.go @@ -321,11 +321,11 @@ func (d *Daemon) StartWithBusybox(arg ...string) error { } } // loading busybox image to this daemon - if _, err := d.Cmd("load", "--input", bb); err != nil { - return fmt.Errorf("could not load busybox image: %v", err) + if out, err := d.Cmd("load", "--input", bb); err != nil { + return fmt.Errorf("could not load busybox image: %s", out) } if err := os.Remove(bb); err != nil { - d.c.Logf("Could not remove %s: %v", bb, err) + d.c.Logf("could not remove %s: %v", bb, err) } return nil }