mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
Fix Windows CI fail due to GH13866 and patch up tests
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
@ -2,8 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"reflect"
|
||||
"regexp"
|
||||
@ -13,38 +11,6 @@ import (
|
||||
"github.com/go-check/check"
|
||||
)
|
||||
|
||||
func (s *DockerSuite) TestLinksEtcHostsRegularFile(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "--net=host", "busybox", "ls", "-la", "/etc/hosts")
|
||||
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil {
|
||||
c.Fatal(out, err)
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(out, "-") {
|
||||
c.Errorf("/etc/hosts should be a regular file")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksEtcHostsContentMatch(c *check.C) {
|
||||
testRequires(c, SameHostDaemon)
|
||||
|
||||
runCmd := exec.Command(dockerBinary, "run", "--net=host", "busybox", "cat", "/etc/hosts")
|
||||
out, _, _, err := runCommandWithStdoutStderr(runCmd)
|
||||
if err != nil {
|
||||
c.Fatal(out, err)
|
||||
}
|
||||
|
||||
hosts, err := ioutil.ReadFile("/etc/hosts")
|
||||
if os.IsNotExist(err) {
|
||||
c.Skip("/etc/hosts does not exist, skip this test")
|
||||
}
|
||||
|
||||
if out != string(hosts) {
|
||||
c.Errorf("container")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksPingUnlinkedContainers(c *check.C) {
|
||||
runCmd := exec.Command(dockerBinary, "run", "--rm", "busybox", "sh", "-c", "ping -c 1 alias1 -W 1 && ping -c 1 alias2 -W 1")
|
||||
exitCode, err := runCommand(runCmd)
|
||||
@ -217,20 +183,6 @@ func (s *DockerSuite) TestLinksHostsFilesInject(c *check.C) {
|
||||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksNetworkHostContainer(c *check.C) {
|
||||
|
||||
out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "run", "-d", "--net", "host", "--name", "host_container", "busybox", "top"))
|
||||
if err != nil {
|
||||
c.Fatal(err, out)
|
||||
}
|
||||
|
||||
out, _, err = runCommandWithOutput(exec.Command(dockerBinary, "run", "--name", "should_fail", "--link", "host_container:tester", "busybox", "true"))
|
||||
if err == nil || !strings.Contains(out, "--net=host can't be used with links. This would result in undefined behavior") {
|
||||
c.Fatalf("Running container linking to a container with --net host should have failed: %s", out)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestLinksUpdateOnRestart(c *check.C) {
|
||||
testRequires(c, SameHostDaemon, ExecSupport)
|
||||
|
||||
|
Reference in New Issue
Block a user