Merge pull request #16363 from coolljt0725/fix_net_none_test

Fix --net none test closes #16356
This commit is contained in:
Brian Goff 2015-09-19 09:25:12 -04:00
commit 7d5603e7cb
1 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,7 @@
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
@ -1492,11 +1493,16 @@ func (s *DockerDaemonSuite) TestRunContainerWithBridgeNone(c *check.C) {
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
c.Assert(strings.Contains(out, "eth0"), check.Equals, false,
check.Commentf("There shouldn't be eth0 in container in bridge mode when bridge network is disabled: %s", out))
cmd := exec.Command("ip", "l")
stdout := bytes.NewBuffer(nil)
cmd.Stdout = stdout
if err := cmd.Run(); err != nil {
c.Fatal("Failed to get host network interface")
}
out, err = s.d.Cmd("run", "--rm", "--net=host", "busybox", "ip", "l")
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
c.Assert(strings.Contains(out, "eth0"), check.Equals, true,
check.Commentf("There should be eth0 in container when --net=host when bridge network is disabled: %s", out))
c.Assert(out, check.Equals, fmt.Sprintf("%s", stdout),
check.Commentf("The network interfaces in container should be the same with host when --net=host when bridge network is disabled: %s", out))
}
func (s *DockerDaemonSuite) TestDaemonRestartWithContainerRunning(t *check.C) {
@ -1618,7 +1624,9 @@ func (s *DockerDaemonSuite) TestDaemonCorruptedSyslogAddress(c *check.C) {
}
func (s *DockerDaemonSuite) TestDaemonWideLogConfig(c *check.C) {
c.Assert(s.d.Start("--log-driver=json-file", "--log-opt=max-size=1k"), check.IsNil)
if err := s.d.StartWithBusybox("--log-driver=json-file", "--log-opt=max-size=1k"); err != nil {
c.Fatal(err)
}
out, err := s.d.Cmd("run", "-d", "--name=logtest", "busybox", "top")
c.Assert(err, check.IsNil, check.Commentf("Output: %s, err: %v", out, err))
out, err = s.d.Cmd("inspect", "-f", "{{ .HostConfig.LogConfig.Config }}", "logtest")