Signed-off-by: Antonio Murdaca <runcom@redhat.com>
| ... | ... |
@@ -136,7 +136,6 @@ func assertAuthHeaders(c *check.C, headers map[string]string) error {
|
| 136 | 136 |
|
| 137 | 137 |
// assertBody asserts that body is removed for non text/json requests |
| 138 | 138 |
func assertBody(c *check.C, requestURI string, headers map[string]string, body []byte) {
|
| 139 |
- |
|
| 140 | 139 |
if strings.Contains(strings.ToLower(requestURI), "auth") && len(body) > 0 {
|
| 141 | 140 |
//return fmt.Errorf("Body included for authentication endpoint %s", string(body))
|
| 142 | 141 |
c.Errorf("Body included for authentication endpoint %s", string(body))
|
| ... | ... |
@@ -164,18 +163,21 @@ func (s *DockerAuthzSuite) TearDownSuite(c *check.C) {
|
| 164 | 164 |
} |
| 165 | 165 |
|
| 166 | 166 |
func (s *DockerAuthzSuite) TestAuthZPluginAllowRequest(c *check.C) {
|
| 167 |
- err := s.d.Start("--authz-plugin=" + testAuthZPlugin)
|
|
| 168 |
- c.Assert(err, check.IsNil) |
|
| 167 |
+ // start the daemon and load busybox, --net=none build fails otherwise |
|
| 168 |
+ // cause it needs to pull busybox |
|
| 169 |
+ c.Assert(s.d.StartWithBusybox(), check.IsNil) |
|
| 170 |
+ // restart the daemon and enable the plugin, otherwise busybox loading |
|
| 171 |
+ // is blocked by the plugin itself |
|
| 172 |
+ c.Assert(s.d.Restart("--authz-plugin="+testAuthZPlugin), check.IsNil)
|
|
| 173 |
+ |
|
| 169 | 174 |
s.ctrl.reqRes.Allow = true |
| 170 | 175 |
s.ctrl.resRes.Allow = true |
| 171 | 176 |
|
| 172 | 177 |
// Ensure command successful |
| 173 |
- out, err := s.d.Cmd("run", "-d", "--name", "container1", "busybox:latest", "top")
|
|
| 178 |
+ out, err := s.d.Cmd("run", "-d", "busybox", "top")
|
|
| 174 | 179 |
c.Assert(err, check.IsNil) |
| 175 | 180 |
|
| 176 |
- // Extract the id of the created container |
|
| 177 |
- res := strings.Split(strings.TrimSpace(out), "\n") |
|
| 178 |
- id := res[len(res)-1] |
|
| 181 |
+ id := strings.TrimSpace(out) |
|
| 179 | 182 |
assertURIRecorded(c, s.ctrl.requestsURIs, "/containers/create") |
| 180 | 183 |
assertURIRecorded(c, s.ctrl.requestsURIs, fmt.Sprintf("/containers/%s/start", id))
|
| 181 | 184 |
|
| ... | ... |
@@ -78,7 +78,7 @@ func (s *DockerSuite) TestInfoDiscoveryInvalidAdvertise(c *check.C) {
|
| 78 | 78 |
// TestInfoDiscoveryAdvertiseInterfaceName verifies that a daemon run with `--cluster-advertise` |
| 79 | 79 |
// configured with interface name properly show the advertise ip-address in info output. |
| 80 | 80 |
func (s *DockerSuite) TestInfoDiscoveryAdvertiseInterfaceName(c *check.C) {
|
| 81 |
- testRequires(c, SameHostDaemon) |
|
| 81 |
+ testRequires(c, SameHostDaemon, Network) |
|
| 82 | 82 |
|
| 83 | 83 |
d := NewDaemon(c) |
| 84 | 84 |
discoveryBackend := "consul://consuladdr:consulport/some/path" |
| ... | ... |
@@ -321,11 +321,11 @@ func (d *Daemon) StartWithBusybox(arg ...string) error {
|
| 321 | 321 |
} |
| 322 | 322 |
} |
| 323 | 323 |
// loading busybox image to this daemon |
| 324 |
- if _, err := d.Cmd("load", "--input", bb); err != nil {
|
|
| 325 |
- return fmt.Errorf("could not load busybox image: %v", err)
|
|
| 324 |
+ if out, err := d.Cmd("load", "--input", bb); err != nil {
|
|
| 325 |
+ return fmt.Errorf("could not load busybox image: %s", out)
|
|
| 326 | 326 |
} |
| 327 | 327 |
if err := os.Remove(bb); err != nil {
|
| 328 |
- d.c.Logf("Could not remove %s: %v", bb, err)
|
|
| 328 |
+ d.c.Logf("could not remove %s: %v", bb, err)
|
|
| 329 | 329 |
} |
| 330 | 330 |
return nil |
| 331 | 331 |
} |