mirror of
https://github.com/moby/moby.git
synced 2025-12-07 19:42:23 +03:00
Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@@ -102,7 +102,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParent(c *check.C) {
|
||||
cgroupParent := "test"
|
||||
name := "cgroup-test"
|
||||
|
||||
out, _, err := dockerCmdWithError(c, "run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
||||
out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
||||
if err != nil {
|
||||
c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
|
||||
}
|
||||
@@ -130,7 +130,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupParentAbsPath(c *check.C) {
|
||||
|
||||
cgroupParent := "/cgroup-parent/test"
|
||||
name := "cgroup-test"
|
||||
out, _, err := dockerCmdWithError(c, "run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
||||
out, _, err := dockerCmdWithError("run", "--cgroup-parent", cgroupParent, "--name", name, "busybox", "cat", "/proc/self/cgroup")
|
||||
if err != nil {
|
||||
c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
|
||||
}
|
||||
@@ -157,7 +157,7 @@ func (s *DockerSuite) TestRunContainerWithCgroupMountRO(c *check.C) {
|
||||
testRequires(c, NativeExecDriver)
|
||||
|
||||
filename := "/sys/fs/cgroup/devices/test123"
|
||||
out, _, err := dockerCmdWithError(c, "run", "busybox", "touch", filename)
|
||||
out, _, err := dockerCmdWithError("run", "busybox", "touch", filename)
|
||||
if err == nil {
|
||||
c.Fatal("expected cgroup mount point to be read-only, touch file should fail")
|
||||
}
|
||||
@@ -252,7 +252,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
|
||||
func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
|
||||
testRequires(c, cpuCfsQuota)
|
||||
|
||||
out, _, err := dockerCmdWithError(c, "run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test")
|
||||
out, _, err := dockerCmdWithError("run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test")
|
||||
if err != nil {
|
||||
c.Fatalf("failed to run container: %v, output: %q", err, out)
|
||||
}
|
||||
@@ -272,7 +272,7 @@ func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
|
||||
func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
|
||||
testRequires(c, cpuCfsPeriod)
|
||||
|
||||
if _, _, err := dockerCmdWithError(c, "run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
|
||||
if _, _, err := dockerCmdWithError("run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
|
||||
c.Fatalf("failed to run container: %v", err)
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
||||
errChan := make(chan error)
|
||||
go func() {
|
||||
defer close(errChan)
|
||||
out, exitCode, _ := dockerCmdWithError(c, "run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
|
||||
out, exitCode, _ := dockerCmdWithError("run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
|
||||
if expected := 137; exitCode != expected {
|
||||
errChan <- fmt.Errorf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out)
|
||||
}
|
||||
@@ -303,29 +303,29 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainerNetworkModeToSelf(c *check.C) {
|
||||
out, _, err := dockerCmdWithError(c, "run", "--name=me", "--net=container:me", "busybox", "true")
|
||||
out, _, err := dockerCmdWithError("run", "--name=me", "--net=container:me", "busybox", "true")
|
||||
if err == nil || !strings.Contains(out, "cannot join own network") {
|
||||
c.Fatalf("using container net mode to self should result in an error")
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
|
||||
out, _, err := dockerCmdWithError(c, "run", "-d", "--name", "parent", "busybox", "top")
|
||||
out, _, err := dockerCmdWithError("run", "-d", "--name", "parent", "busybox", "top")
|
||||
if err != nil {
|
||||
c.Fatalf("failed to run container: %v, output: %q", err, out)
|
||||
}
|
||||
|
||||
out, _, err = dockerCmdWithError(c, "run", "--dns", "1.2.3.4", "--net=container:parent", "busybox")
|
||||
out, _, err = dockerCmdWithError("run", "--dns", "1.2.3.4", "--net=container:parent", "busybox")
|
||||
if err == nil || !strings.Contains(out, "Conflicting options: --dns and the network mode") {
|
||||
c.Fatalf("run --net=container with --dns should error out")
|
||||
}
|
||||
|
||||
out, _, err = dockerCmdWithError(c, "run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox")
|
||||
out, _, err = dockerCmdWithError("run", "--mac-address", "92:d0:c6:0a:29:33", "--net=container:parent", "busybox")
|
||||
if err == nil || !strings.Contains(out, "--mac-address and the network mode") {
|
||||
c.Fatalf("run --net=container with --mac-address should error out")
|
||||
}
|
||||
|
||||
out, _, err = dockerCmdWithError(c, "run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox")
|
||||
out, _, err = dockerCmdWithError("run", "--add-host", "test:192.168.2.109", "--net=container:parent", "busybox")
|
||||
if err == nil || !strings.Contains(out, "--add-host and the network mode") {
|
||||
c.Fatalf("run --net=container with --add-host should error out")
|
||||
}
|
||||
@@ -334,17 +334,17 @@ func (s *DockerSuite) TestRunContainerNetModeWithDnsMacHosts(c *check.C) {
|
||||
func (s *DockerSuite) TestRunContainerNetModeWithExposePort(c *check.C) {
|
||||
dockerCmd(c, "run", "-d", "--name", "parent", "busybox", "top")
|
||||
|
||||
out, _, err := dockerCmdWithError(c, "run", "-p", "5000:5000", "--net=container:parent", "busybox")
|
||||
out, _, err := dockerCmdWithError("run", "-p", "5000:5000", "--net=container:parent", "busybox")
|
||||
if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
|
||||
c.Fatalf("run --net=container with -p should error out")
|
||||
}
|
||||
|
||||
out, _, err = dockerCmdWithError(c, "run", "-P", "--net=container:parent", "busybox")
|
||||
out, _, err = dockerCmdWithError("run", "-P", "--net=container:parent", "busybox")
|
||||
if err == nil || !strings.Contains(out, "Conflicting options: -p, -P, --publish-all, --publish and the network mode (--net)") {
|
||||
c.Fatalf("run --net=container with -P should error out")
|
||||
}
|
||||
|
||||
out, _, err = dockerCmdWithError(c, "run", "--expose", "5000", "--net=container:parent", "busybox")
|
||||
out, _, err = dockerCmdWithError("run", "--expose", "5000", "--net=container:parent", "busybox")
|
||||
if err == nil || !strings.Contains(out, "Conflicting options: --expose and the network mode (--expose)") {
|
||||
c.Fatalf("run --net=container with --expose should error out")
|
||||
}
|
||||
@@ -399,7 +399,7 @@ func (s *DockerSuite) TestRunModeNetContainerHostname(c *check.C) {
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestRunNetworkNotInitializedNoneMode(c *check.C) {
|
||||
out, _, err := dockerCmdWithError(c, "run", "-d", "--net=none", "busybox", "top")
|
||||
out, _, err := dockerCmdWithError("run", "-d", "--net=none", "busybox", "top")
|
||||
id := strings.TrimSpace(out)
|
||||
res, err := inspectField(id, "NetworkSettings.IPAddress")
|
||||
c.Assert(err, check.IsNil)
|
||||
|
||||
Reference in New Issue
Block a user