Signed-off-by: Vincent Demeester <vincent@sbr.pm>
| ... | ... |
@@ -212,7 +212,7 @@ func (s *DockerSuite) TestGetContainerStats(c *check.C) {
|
| 212 | 212 |
} |
| 213 | 213 |
|
| 214 | 214 |
func (s *DockerSuite) TestGetContainerStatsRmRunning(c *check.C) {
|
| 215 |
- out, _ := runSleepingContainer(c) |
|
| 215 |
+ out := runSleepingContainer(c) |
|
| 216 | 216 |
id := strings.TrimSpace(out) |
| 217 | 217 |
|
| 218 | 218 |
buf := &testutil.ChannelBuffer{C: make(chan []byte, 1)}
|
| ... | ... |
@@ -401,7 +401,7 @@ func (s *DockerSuite) TestContainerAPITop(c *check.C) {
|
| 401 | 401 |
|
| 402 | 402 |
func (s *DockerSuite) TestContainerAPITopWindows(c *check.C) {
|
| 403 | 403 |
testRequires(c, DaemonIsWindows) |
| 404 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 404 |
+ out := runSleepingContainer(c, "-d") |
|
| 405 | 405 |
id := strings.TrimSpace(string(out)) |
| 406 | 406 |
c.Assert(waitRun(id), checker.IsNil) |
| 407 | 407 |
|
| ... | ... |
@@ -892,7 +892,7 @@ func (s *DockerSuite) TestContainerAPIRestart(c *check.C) {
|
| 892 | 892 |
|
| 893 | 893 |
func (s *DockerSuite) TestContainerAPIRestartNotimeoutParam(c *check.C) {
|
| 894 | 894 |
name := "test-api-restart-no-timeout-param" |
| 895 |
- out, _ := runSleepingContainer(c, "-di", "--name", name) |
|
| 895 |
+ out := runSleepingContainer(c, "-di", "--name", name) |
|
| 896 | 896 |
id := strings.TrimSpace(out) |
| 897 | 897 |
c.Assert(waitRun(id), checker.IsNil) |
| 898 | 898 |
|
| ... | ... |
@@ -1047,7 +1047,7 @@ func (s *DockerSuite) TestContainerAPICopyContainerNotFoundPr124(c *check.C) {
|
| 1047 | 1047 |
} |
| 1048 | 1048 |
|
| 1049 | 1049 |
func (s *DockerSuite) TestContainerAPIDelete(c *check.C) {
|
| 1050 |
- out, _ := runSleepingContainer(c) |
|
| 1050 |
+ out := runSleepingContainer(c) |
|
| 1051 | 1051 |
|
| 1052 | 1052 |
id := strings.TrimSpace(out) |
| 1053 | 1053 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1067,7 +1067,7 @@ func (s *DockerSuite) TestContainerAPIDeleteNotExist(c *check.C) {
|
| 1067 | 1067 |
} |
| 1068 | 1068 |
|
| 1069 | 1069 |
func (s *DockerSuite) TestContainerAPIDeleteForce(c *check.C) {
|
| 1070 |
- out, _ := runSleepingContainer(c) |
|
| 1070 |
+ out := runSleepingContainer(c) |
|
| 1071 | 1071 |
|
| 1072 | 1072 |
id := strings.TrimSpace(out) |
| 1073 | 1073 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1102,7 +1102,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveLinks(c *check.C) {
|
| 1102 | 1102 |
} |
| 1103 | 1103 |
|
| 1104 | 1104 |
func (s *DockerSuite) TestContainerAPIDeleteConflict(c *check.C) {
|
| 1105 |
- out, _ := runSleepingContainer(c) |
|
| 1105 |
+ out := runSleepingContainer(c) |
|
| 1106 | 1106 |
|
| 1107 | 1107 |
id := strings.TrimSpace(out) |
| 1108 | 1108 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1120,7 +1120,7 @@ func (s *DockerSuite) TestContainerAPIDeleteRemoveVolume(c *check.C) {
|
| 1120 | 1120 |
vol = `c:\testvolume` |
| 1121 | 1121 |
} |
| 1122 | 1122 |
|
| 1123 |
- out, _ := runSleepingContainer(c, "-v", vol) |
|
| 1123 |
+ out := runSleepingContainer(c, "-v", vol) |
|
| 1124 | 1124 |
|
| 1125 | 1125 |
id := strings.TrimSpace(out) |
| 1126 | 1126 |
c.Assert(waitRun(id), checker.IsNil) |
| ... | ... |
@@ -1158,7 +1158,7 @@ func (s *DockerSuite) TestContainerAPIChunkedEncoding(c *check.C) {
|
| 1158 | 1158 |
} |
| 1159 | 1159 |
|
| 1160 | 1160 |
func (s *DockerSuite) TestContainerAPIPostContainerStop(c *check.C) {
|
| 1161 |
- out, _ := runSleepingContainer(c) |
|
| 1161 |
+ out := runSleepingContainer(c) |
|
| 1162 | 1162 |
|
| 1163 | 1163 |
containerID := strings.TrimSpace(out) |
| 1164 | 1164 |
c.Assert(waitRun(containerID), checker.IsNil) |
| ... | ... |
@@ -40,7 +40,7 @@ func (s *DockerSuite) TestEventsAPIBackwardsCompatible(c *check.C) {
|
| 40 | 40 |
since := daemonTime(c).Unix() |
| 41 | 41 |
ts := strconv.FormatInt(since, 10) |
| 42 | 42 |
|
| 43 |
- out, _ := runSleepingContainer(c, "--name=foo", "-d") |
|
| 43 |
+ out := runSleepingContainer(c, "--name=foo", "-d") |
|
| 44 | 44 |
containerID := strings.TrimSpace(out) |
| 45 | 45 |
c.Assert(waitRun(containerID), checker.IsNil) |
| 46 | 46 |
|
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 | 12 |
func (s *DockerSuite) TestResizeAPIResponse(c *check.C) {
|
| 13 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 13 |
+ out := runSleepingContainer(c, "-d") |
|
| 14 | 14 |
cleanedContainerID := strings.TrimSpace(out) |
| 15 | 15 |
|
| 16 | 16 |
endpoint := "/containers/" + cleanedContainerID + "/resize?h=40&w=40" |
| ... | ... |
@@ -20,7 +20,7 @@ func (s *DockerSuite) TestResizeAPIResponse(c *check.C) {
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
func (s *DockerSuite) TestResizeAPIHeightWidthNoInt(c *check.C) {
|
| 23 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 23 |
+ out := runSleepingContainer(c, "-d") |
|
| 24 | 24 |
cleanedContainerID := strings.TrimSpace(out) |
| 25 | 25 |
|
| 26 | 26 |
endpoint := "/containers/" + cleanedContainerID + "/resize?h=foo&w=bar" |
| ... | ... |
@@ -98,7 +98,7 @@ func (s *DockerSuite) TestAPIStatsStoppedContainerInGoroutines(c *check.C) {
|
| 98 | 98 |
func (s *DockerSuite) TestAPIStatsNetworkStats(c *check.C) {
|
| 99 | 99 |
testRequires(c, SameHostDaemon) |
| 100 | 100 |
|
| 101 |
- out, _ := runSleepingContainer(c) |
|
| 101 |
+ out := runSleepingContainer(c) |
|
| 102 | 102 |
id := strings.TrimSpace(out) |
| 103 | 103 |
c.Assert(waitRun(id), checker.IsNil) |
| 104 | 104 |
|
| ... | ... |
@@ -166,7 +166,7 @@ func (s *DockerSuite) TestAPIStatsNetworkStatsVersioning(c *check.C) {
|
| 166 | 166 |
// Windows doesn't support API versions less than 1.25, so no point testing 1.17 .. 1.21 |
| 167 | 167 |
testRequires(c, SameHostDaemon, DaemonIsLinux) |
| 168 | 168 |
|
| 169 |
- out, _ := runSleepingContainer(c) |
|
| 169 |
+ out := runSleepingContainer(c) |
|
| 170 | 170 |
id := strings.TrimSpace(out) |
| 171 | 171 |
c.Assert(waitRun(id), checker.IsNil) |
| 172 | 172 |
wg := sync.WaitGroup{}
|
| ... | ... |
@@ -274,11 +274,11 @@ func (s *DockerSuite) TestAPIStatsContainerNotFound(c *check.C) {
|
| 274 | 274 |
func (s *DockerSuite) TestAPIStatsNoStreamConnectedContainers(c *check.C) {
|
| 275 | 275 |
testRequires(c, DaemonIsLinux) |
| 276 | 276 |
|
| 277 |
- out1, _ := runSleepingContainer(c) |
|
| 277 |
+ out1 := runSleepingContainer(c) |
|
| 278 | 278 |
id1 := strings.TrimSpace(out1) |
| 279 | 279 |
c.Assert(waitRun(id1), checker.IsNil) |
| 280 | 280 |
|
| 281 |
- out2, _ := runSleepingContainer(c, "--net", "container:"+id1) |
|
| 281 |
+ out2 := runSleepingContainer(c, "--net", "container:"+id1) |
|
| 282 | 282 |
id2 := strings.TrimSpace(out2) |
| 283 | 283 |
c.Assert(waitRun(id2), checker.IsNil) |
| 284 | 284 |
|
| 285 | 285 |
deleted file mode 100644 |
| ... | ... |
@@ -1,319 +0,0 @@ |
| 1 |
-package main |
|
| 2 |
- |
|
| 3 |
-import ( |
|
| 4 |
- "bytes" |
|
| 5 |
- "fmt" |
|
| 6 |
- "io/ioutil" |
|
| 7 |
- "os" |
|
| 8 |
- "os/exec" |
|
| 9 |
- "path/filepath" |
|
| 10 |
- "runtime" |
|
| 11 |
- "strings" |
|
| 12 |
- |
|
| 13 |
- "github.com/docker/docker/integration-cli/checker" |
|
| 14 |
- "github.com/docker/docker/pkg/archive" |
|
| 15 |
- "github.com/go-check/check" |
|
| 16 |
-) |
|
| 17 |
- |
|
| 18 |
-type fileType uint32 |
|
| 19 |
- |
|
| 20 |
-const ( |
|
| 21 |
- ftRegular fileType = iota |
|
| 22 |
- ftDir |
|
| 23 |
- ftSymlink |
|
| 24 |
-) |
|
| 25 |
- |
|
| 26 |
-type fileData struct {
|
|
| 27 |
- filetype fileType |
|
| 28 |
- path string |
|
| 29 |
- contents string |
|
| 30 |
- uid int |
|
| 31 |
- gid int |
|
| 32 |
- mode int |
|
| 33 |
-} |
|
| 34 |
- |
|
| 35 |
-func (fd fileData) creationCommand() string {
|
|
| 36 |
- var command string |
|
| 37 |
- |
|
| 38 |
- switch fd.filetype {
|
|
| 39 |
- case ftRegular: |
|
| 40 |
- // Don't overwrite the file if it already exists! |
|
| 41 |
- command = fmt.Sprintf("if [ ! -f %s ]; then echo %q > %s; fi", fd.path, fd.contents, fd.path)
|
|
| 42 |
- case ftDir: |
|
| 43 |
- command = fmt.Sprintf("mkdir -p %s", fd.path)
|
|
| 44 |
- case ftSymlink: |
|
| 45 |
- command = fmt.Sprintf("ln -fs %s %s", fd.contents, fd.path)
|
|
| 46 |
- } |
|
| 47 |
- |
|
| 48 |
- return command |
|
| 49 |
-} |
|
| 50 |
- |
|
| 51 |
-func mkFilesCommand(fds []fileData) string {
|
|
| 52 |
- commands := make([]string, len(fds)) |
|
| 53 |
- |
|
| 54 |
- for i, fd := range fds {
|
|
| 55 |
- commands[i] = fd.creationCommand() |
|
| 56 |
- } |
|
| 57 |
- |
|
| 58 |
- return strings.Join(commands, " && ") |
|
| 59 |
-} |
|
| 60 |
- |
|
| 61 |
-var defaultFileData = []fileData{
|
|
| 62 |
- {ftRegular, "file1", "file1", 0, 0, 0666},
|
|
| 63 |
- {ftRegular, "file2", "file2", 0, 0, 0666},
|
|
| 64 |
- {ftRegular, "file3", "file3", 0, 0, 0666},
|
|
| 65 |
- {ftRegular, "file4", "file4", 0, 0, 0666},
|
|
| 66 |
- {ftRegular, "file5", "file5", 0, 0, 0666},
|
|
| 67 |
- {ftRegular, "file6", "file6", 0, 0, 0666},
|
|
| 68 |
- {ftRegular, "file7", "file7", 0, 0, 0666},
|
|
| 69 |
- {ftDir, "dir1", "", 0, 0, 0777},
|
|
| 70 |
- {ftRegular, "dir1/file1-1", "file1-1", 0, 0, 0666},
|
|
| 71 |
- {ftRegular, "dir1/file1-2", "file1-2", 0, 0, 0666},
|
|
| 72 |
- {ftDir, "dir2", "", 0, 0, 0666},
|
|
| 73 |
- {ftRegular, "dir2/file2-1", "file2-1", 0, 0, 0666},
|
|
| 74 |
- {ftRegular, "dir2/file2-2", "file2-2", 0, 0, 0666},
|
|
| 75 |
- {ftDir, "dir3", "", 0, 0, 0666},
|
|
| 76 |
- {ftRegular, "dir3/file3-1", "file3-1", 0, 0, 0666},
|
|
| 77 |
- {ftRegular, "dir3/file3-2", "file3-2", 0, 0, 0666},
|
|
| 78 |
- {ftDir, "dir4", "", 0, 0, 0666},
|
|
| 79 |
- {ftRegular, "dir4/file3-1", "file4-1", 0, 0, 0666},
|
|
| 80 |
- {ftRegular, "dir4/file3-2", "file4-2", 0, 0, 0666},
|
|
| 81 |
- {ftDir, "dir5", "", 0, 0, 0666},
|
|
| 82 |
- {ftSymlink, "symlinkToFile1", "file1", 0, 0, 0666},
|
|
| 83 |
- {ftSymlink, "symlinkToDir1", "dir1", 0, 0, 0666},
|
|
| 84 |
- {ftSymlink, "brokenSymlinkToFileX", "fileX", 0, 0, 0666},
|
|
| 85 |
- {ftSymlink, "brokenSymlinkToDirX", "dirX", 0, 0, 0666},
|
|
| 86 |
- {ftSymlink, "symlinkToAbsDir", "/root", 0, 0, 0666},
|
|
| 87 |
- {ftDir, "permdirtest", "", 2, 2, 0700},
|
|
| 88 |
- {ftRegular, "permdirtest/permtest", "perm_test", 65534, 65534, 0400},
|
|
| 89 |
-} |
|
| 90 |
- |
|
| 91 |
-func defaultMkContentCommand() string {
|
|
| 92 |
- return mkFilesCommand(defaultFileData) |
|
| 93 |
-} |
|
| 94 |
- |
|
| 95 |
-func makeTestContentInDir(c *check.C, dir string) {
|
|
| 96 |
- for _, fd := range defaultFileData {
|
|
| 97 |
- path := filepath.Join(dir, filepath.FromSlash(fd.path)) |
|
| 98 |
- switch fd.filetype {
|
|
| 99 |
- case ftRegular: |
|
| 100 |
- c.Assert(ioutil.WriteFile(path, []byte(fd.contents+"\n"), os.FileMode(fd.mode)), checker.IsNil) |
|
| 101 |
- case ftDir: |
|
| 102 |
- c.Assert(os.Mkdir(path, os.FileMode(fd.mode)), checker.IsNil) |
|
| 103 |
- case ftSymlink: |
|
| 104 |
- c.Assert(os.Symlink(fd.contents, path), checker.IsNil) |
|
| 105 |
- } |
|
| 106 |
- |
|
| 107 |
- if fd.filetype != ftSymlink && runtime.GOOS != "windows" {
|
|
| 108 |
- c.Assert(os.Chown(path, fd.uid, fd.gid), checker.IsNil) |
|
| 109 |
- } |
|
| 110 |
- } |
|
| 111 |
-} |
|
| 112 |
- |
|
| 113 |
-type testContainerOptions struct {
|
|
| 114 |
- addContent bool |
|
| 115 |
- readOnly bool |
|
| 116 |
- volumes []string |
|
| 117 |
- workDir string |
|
| 118 |
- command string |
|
| 119 |
-} |
|
| 120 |
- |
|
| 121 |
-func makeTestContainer(c *check.C, options testContainerOptions) (containerID string) {
|
|
| 122 |
- if options.addContent {
|
|
| 123 |
- mkContentCmd := defaultMkContentCommand() |
|
| 124 |
- if options.command == "" {
|
|
| 125 |
- options.command = mkContentCmd |
|
| 126 |
- } else {
|
|
| 127 |
- options.command = fmt.Sprintf("%s && %s", defaultMkContentCommand(), options.command)
|
|
| 128 |
- } |
|
| 129 |
- } |
|
| 130 |
- |
|
| 131 |
- if options.command == "" {
|
|
| 132 |
- options.command = "#(nop)" |
|
| 133 |
- } |
|
| 134 |
- |
|
| 135 |
- args := []string{"run", "-d"}
|
|
| 136 |
- |
|
| 137 |
- for _, volume := range options.volumes {
|
|
| 138 |
- args = append(args, "-v", volume) |
|
| 139 |
- } |
|
| 140 |
- |
|
| 141 |
- if options.workDir != "" {
|
|
| 142 |
- args = append(args, "-w", options.workDir) |
|
| 143 |
- } |
|
| 144 |
- |
|
| 145 |
- if options.readOnly {
|
|
| 146 |
- args = append(args, "--read-only") |
|
| 147 |
- } |
|
| 148 |
- |
|
| 149 |
- args = append(args, "busybox", "/bin/sh", "-c", options.command) |
|
| 150 |
- |
|
| 151 |
- out, _ := dockerCmd(c, args...) |
|
| 152 |
- |
|
| 153 |
- containerID = strings.TrimSpace(out) |
|
| 154 |
- |
|
| 155 |
- out, _ = dockerCmd(c, "wait", containerID) |
|
| 156 |
- |
|
| 157 |
- exitCode := strings.TrimSpace(out) |
|
| 158 |
- if exitCode != "0" {
|
|
| 159 |
- out, _ = dockerCmd(c, "logs", containerID) |
|
| 160 |
- } |
|
| 161 |
- c.Assert(exitCode, checker.Equals, "0", check.Commentf("failed to make test container: %s", out))
|
|
| 162 |
- |
|
| 163 |
- return |
|
| 164 |
-} |
|
| 165 |
- |
|
| 166 |
-func makeCatFileCommand(path string) string {
|
|
| 167 |
- return fmt.Sprintf("if [ -f %s ]; then cat %s; fi", path, path)
|
|
| 168 |
-} |
|
| 169 |
- |
|
| 170 |
-func cpPath(pathElements ...string) string {
|
|
| 171 |
- localizedPathElements := make([]string, len(pathElements)) |
|
| 172 |
- for i, path := range pathElements {
|
|
| 173 |
- localizedPathElements[i] = filepath.FromSlash(path) |
|
| 174 |
- } |
|
| 175 |
- return strings.Join(localizedPathElements, string(filepath.Separator)) |
|
| 176 |
-} |
|
| 177 |
- |
|
| 178 |
-func cpPathTrailingSep(pathElements ...string) string {
|
|
| 179 |
- return fmt.Sprintf("%s%c", cpPath(pathElements...), filepath.Separator)
|
|
| 180 |
-} |
|
| 181 |
- |
|
| 182 |
-func containerCpPath(containerID string, pathElements ...string) string {
|
|
| 183 |
- joined := strings.Join(pathElements, "/") |
|
| 184 |
- return fmt.Sprintf("%s:%s", containerID, joined)
|
|
| 185 |
-} |
|
| 186 |
- |
|
| 187 |
-func containerCpPathTrailingSep(containerID string, pathElements ...string) string {
|
|
| 188 |
- return fmt.Sprintf("%s/", containerCpPath(containerID, pathElements...))
|
|
| 189 |
-} |
|
| 190 |
- |
|
| 191 |
-func runDockerCp(c *check.C, src, dst string, params []string) (err error) {
|
|
| 192 |
- c.Logf("running `docker cp %s %s %s`", strings.Join(params, " "), src, dst)
|
|
| 193 |
- |
|
| 194 |
- args := []string{"cp"}
|
|
| 195 |
- |
|
| 196 |
- for _, param := range params {
|
|
| 197 |
- args = append(args, param) |
|
| 198 |
- } |
|
| 199 |
- |
|
| 200 |
- args = append(args, src, dst) |
|
| 201 |
- |
|
| 202 |
- out, _, err := runCommandWithOutput(exec.Command(dockerBinary, args...)) |
|
| 203 |
- if err != nil {
|
|
| 204 |
- err = fmt.Errorf("error executing `docker cp` command: %s: %s", err, out)
|
|
| 205 |
- } |
|
| 206 |
- |
|
| 207 |
- return |
|
| 208 |
-} |
|
| 209 |
- |
|
| 210 |
-func startContainerGetOutput(c *check.C, containerID string) (out string, err error) {
|
|
| 211 |
- c.Logf("running `docker start -a %s`", containerID)
|
|
| 212 |
- |
|
| 213 |
- args := []string{"start", "-a", containerID}
|
|
| 214 |
- |
|
| 215 |
- out, _, err = runCommandWithOutput(exec.Command(dockerBinary, args...)) |
|
| 216 |
- if err != nil {
|
|
| 217 |
- err = fmt.Errorf("error executing `docker start` command: %s: %s", err, out)
|
|
| 218 |
- } |
|
| 219 |
- |
|
| 220 |
- return |
|
| 221 |
-} |
|
| 222 |
- |
|
| 223 |
-func getTestDir(c *check.C, label string) (tmpDir string) {
|
|
| 224 |
- var err error |
|
| 225 |
- |
|
| 226 |
- tmpDir, err = ioutil.TempDir("", label)
|
|
| 227 |
- // unable to make temporary directory |
|
| 228 |
- c.Assert(err, checker.IsNil) |
|
| 229 |
- |
|
| 230 |
- return |
|
| 231 |
-} |
|
| 232 |
- |
|
| 233 |
-func isCpNotExist(err error) bool {
|
|
| 234 |
- return strings.Contains(err.Error(), "no such file or directory") || strings.Contains(err.Error(), "cannot find the file specified") |
|
| 235 |
-} |
|
| 236 |
- |
|
| 237 |
-func isCpDirNotExist(err error) bool {
|
|
| 238 |
- return strings.Contains(err.Error(), archive.ErrDirNotExists.Error()) |
|
| 239 |
-} |
|
| 240 |
- |
|
| 241 |
-func isCpNotDir(err error) bool {
|
|
| 242 |
- return strings.Contains(err.Error(), archive.ErrNotDirectory.Error()) || strings.Contains(err.Error(), "filename, directory name, or volume label syntax is incorrect") |
|
| 243 |
-} |
|
| 244 |
- |
|
| 245 |
-func isCpCannotCopyDir(err error) bool {
|
|
| 246 |
- return strings.Contains(err.Error(), archive.ErrCannotCopyDir.Error()) |
|
| 247 |
-} |
|
| 248 |
- |
|
| 249 |
-func isCpCannotCopyReadOnly(err error) bool {
|
|
| 250 |
- return strings.Contains(err.Error(), "marked read-only") |
|
| 251 |
-} |
|
| 252 |
- |
|
| 253 |
-func isCannotOverwriteNonDirWithDir(err error) bool {
|
|
| 254 |
- return strings.Contains(err.Error(), "cannot overwrite non-directory") |
|
| 255 |
-} |
|
| 256 |
- |
|
| 257 |
-func fileContentEquals(c *check.C, filename, contents string) (err error) {
|
|
| 258 |
- c.Logf("checking that file %q contains %q\n", filename, contents)
|
|
| 259 |
- |
|
| 260 |
- fileBytes, err := ioutil.ReadFile(filename) |
|
| 261 |
- if err != nil {
|
|
| 262 |
- return |
|
| 263 |
- } |
|
| 264 |
- |
|
| 265 |
- expectedBytes, err := ioutil.ReadAll(strings.NewReader(contents)) |
|
| 266 |
- if err != nil {
|
|
| 267 |
- return |
|
| 268 |
- } |
|
| 269 |
- |
|
| 270 |
- if !bytes.Equal(fileBytes, expectedBytes) {
|
|
| 271 |
- err = fmt.Errorf("file content not equal - expected %q, got %q", string(expectedBytes), string(fileBytes))
|
|
| 272 |
- } |
|
| 273 |
- |
|
| 274 |
- return |
|
| 275 |
-} |
|
| 276 |
- |
|
| 277 |
-func symlinkTargetEquals(c *check.C, symlink, expectedTarget string) (err error) {
|
|
| 278 |
- c.Logf("checking that the symlink %q points to %q\n", symlink, expectedTarget)
|
|
| 279 |
- |
|
| 280 |
- actualTarget, err := os.Readlink(symlink) |
|
| 281 |
- if err != nil {
|
|
| 282 |
- return |
|
| 283 |
- } |
|
| 284 |
- |
|
| 285 |
- if actualTarget != expectedTarget {
|
|
| 286 |
- err = fmt.Errorf("symlink target points to %q not %q", actualTarget, expectedTarget)
|
|
| 287 |
- } |
|
| 288 |
- |
|
| 289 |
- return |
|
| 290 |
-} |
|
| 291 |
- |
|
| 292 |
-func containerStartOutputEquals(c *check.C, containerID, contents string) (err error) {
|
|
| 293 |
- c.Logf("checking that container %q start output contains %q\n", containerID, contents)
|
|
| 294 |
- |
|
| 295 |
- out, err := startContainerGetOutput(c, containerID) |
|
| 296 |
- if err != nil {
|
|
| 297 |
- return |
|
| 298 |
- } |
|
| 299 |
- |
|
| 300 |
- if out != contents {
|
|
| 301 |
- err = fmt.Errorf("output contents not equal - expected %q, got %q", contents, out)
|
|
| 302 |
- } |
|
| 303 |
- |
|
| 304 |
- return |
|
| 305 |
-} |
|
| 306 |
- |
|
| 307 |
-func defaultVolumes(tmpDir string) []string {
|
|
| 308 |
- if SameHostDaemon() {
|
|
| 309 |
- return []string{
|
|
| 310 |
- "/vol1", |
|
| 311 |
- fmt.Sprintf("%s:/vol2", tmpDir),
|
|
| 312 |
- fmt.Sprintf("%s:/vol3", filepath.Join(tmpDir, "vol3")),
|
|
| 313 |
- fmt.Sprintf("%s:/vol_ro:ro", filepath.Join(tmpDir, "vol_ro")),
|
|
| 314 |
- } |
|
| 315 |
- } |
|
| 316 |
- |
|
| 317 |
- // Can't bind-mount volumes with separate host daemon. |
|
| 318 |
- return []string{"/vol1", "/vol2", "/vol3", "/vol_ro:/vol_ro:ro"}
|
|
| 319 |
-} |
| 320 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,319 @@ |
| 0 |
+package main |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "bytes" |
|
| 4 |
+ "fmt" |
|
| 5 |
+ "io/ioutil" |
|
| 6 |
+ "os" |
|
| 7 |
+ "os/exec" |
|
| 8 |
+ "path/filepath" |
|
| 9 |
+ "runtime" |
|
| 10 |
+ "strings" |
|
| 11 |
+ |
|
| 12 |
+ "github.com/docker/docker/integration-cli/checker" |
|
| 13 |
+ "github.com/docker/docker/pkg/archive" |
|
| 14 |
+ "github.com/go-check/check" |
|
| 15 |
+) |
|
| 16 |
+ |
|
| 17 |
+type fileType uint32 |
|
| 18 |
+ |
|
| 19 |
+const ( |
|
| 20 |
+ ftRegular fileType = iota |
|
| 21 |
+ ftDir |
|
| 22 |
+ ftSymlink |
|
| 23 |
+) |
|
| 24 |
+ |
|
| 25 |
+type fileData struct {
|
|
| 26 |
+ filetype fileType |
|
| 27 |
+ path string |
|
| 28 |
+ contents string |
|
| 29 |
+ uid int |
|
| 30 |
+ gid int |
|
| 31 |
+ mode int |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+func (fd fileData) creationCommand() string {
|
|
| 35 |
+ var command string |
|
| 36 |
+ |
|
| 37 |
+ switch fd.filetype {
|
|
| 38 |
+ case ftRegular: |
|
| 39 |
+ // Don't overwrite the file if it already exists! |
|
| 40 |
+ command = fmt.Sprintf("if [ ! -f %s ]; then echo %q > %s; fi", fd.path, fd.contents, fd.path)
|
|
| 41 |
+ case ftDir: |
|
| 42 |
+ command = fmt.Sprintf("mkdir -p %s", fd.path)
|
|
| 43 |
+ case ftSymlink: |
|
| 44 |
+ command = fmt.Sprintf("ln -fs %s %s", fd.contents, fd.path)
|
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 47 |
+ return command |
|
| 48 |
+} |
|
| 49 |
+ |
|
| 50 |
+func mkFilesCommand(fds []fileData) string {
|
|
| 51 |
+ commands := make([]string, len(fds)) |
|
| 52 |
+ |
|
| 53 |
+ for i, fd := range fds {
|
|
| 54 |
+ commands[i] = fd.creationCommand() |
|
| 55 |
+ } |
|
| 56 |
+ |
|
| 57 |
+ return strings.Join(commands, " && ") |
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+var defaultFileData = []fileData{
|
|
| 61 |
+ {ftRegular, "file1", "file1", 0, 0, 0666},
|
|
| 62 |
+ {ftRegular, "file2", "file2", 0, 0, 0666},
|
|
| 63 |
+ {ftRegular, "file3", "file3", 0, 0, 0666},
|
|
| 64 |
+ {ftRegular, "file4", "file4", 0, 0, 0666},
|
|
| 65 |
+ {ftRegular, "file5", "file5", 0, 0, 0666},
|
|
| 66 |
+ {ftRegular, "file6", "file6", 0, 0, 0666},
|
|
| 67 |
+ {ftRegular, "file7", "file7", 0, 0, 0666},
|
|
| 68 |
+ {ftDir, "dir1", "", 0, 0, 0777},
|
|
| 69 |
+ {ftRegular, "dir1/file1-1", "file1-1", 0, 0, 0666},
|
|
| 70 |
+ {ftRegular, "dir1/file1-2", "file1-2", 0, 0, 0666},
|
|
| 71 |
+ {ftDir, "dir2", "", 0, 0, 0666},
|
|
| 72 |
+ {ftRegular, "dir2/file2-1", "file2-1", 0, 0, 0666},
|
|
| 73 |
+ {ftRegular, "dir2/file2-2", "file2-2", 0, 0, 0666},
|
|
| 74 |
+ {ftDir, "dir3", "", 0, 0, 0666},
|
|
| 75 |
+ {ftRegular, "dir3/file3-1", "file3-1", 0, 0, 0666},
|
|
| 76 |
+ {ftRegular, "dir3/file3-2", "file3-2", 0, 0, 0666},
|
|
| 77 |
+ {ftDir, "dir4", "", 0, 0, 0666},
|
|
| 78 |
+ {ftRegular, "dir4/file3-1", "file4-1", 0, 0, 0666},
|
|
| 79 |
+ {ftRegular, "dir4/file3-2", "file4-2", 0, 0, 0666},
|
|
| 80 |
+ {ftDir, "dir5", "", 0, 0, 0666},
|
|
| 81 |
+ {ftSymlink, "symlinkToFile1", "file1", 0, 0, 0666},
|
|
| 82 |
+ {ftSymlink, "symlinkToDir1", "dir1", 0, 0, 0666},
|
|
| 83 |
+ {ftSymlink, "brokenSymlinkToFileX", "fileX", 0, 0, 0666},
|
|
| 84 |
+ {ftSymlink, "brokenSymlinkToDirX", "dirX", 0, 0, 0666},
|
|
| 85 |
+ {ftSymlink, "symlinkToAbsDir", "/root", 0, 0, 0666},
|
|
| 86 |
+ {ftDir, "permdirtest", "", 2, 2, 0700},
|
|
| 87 |
+ {ftRegular, "permdirtest/permtest", "perm_test", 65534, 65534, 0400},
|
|
| 88 |
+} |
|
| 89 |
+ |
|
| 90 |
+func defaultMkContentCommand() string {
|
|
| 91 |
+ return mkFilesCommand(defaultFileData) |
|
| 92 |
+} |
|
| 93 |
+ |
|
| 94 |
+func makeTestContentInDir(c *check.C, dir string) {
|
|
| 95 |
+ for _, fd := range defaultFileData {
|
|
| 96 |
+ path := filepath.Join(dir, filepath.FromSlash(fd.path)) |
|
| 97 |
+ switch fd.filetype {
|
|
| 98 |
+ case ftRegular: |
|
| 99 |
+ c.Assert(ioutil.WriteFile(path, []byte(fd.contents+"\n"), os.FileMode(fd.mode)), checker.IsNil) |
|
| 100 |
+ case ftDir: |
|
| 101 |
+ c.Assert(os.Mkdir(path, os.FileMode(fd.mode)), checker.IsNil) |
|
| 102 |
+ case ftSymlink: |
|
| 103 |
+ c.Assert(os.Symlink(fd.contents, path), checker.IsNil) |
|
| 104 |
+ } |
|
| 105 |
+ |
|
| 106 |
+ if fd.filetype != ftSymlink && runtime.GOOS != "windows" {
|
|
| 107 |
+ c.Assert(os.Chown(path, fd.uid, fd.gid), checker.IsNil) |
|
| 108 |
+ } |
|
| 109 |
+ } |
|
| 110 |
+} |
|
| 111 |
+ |
|
| 112 |
+type testContainerOptions struct {
|
|
| 113 |
+ addContent bool |
|
| 114 |
+ readOnly bool |
|
| 115 |
+ volumes []string |
|
| 116 |
+ workDir string |
|
| 117 |
+ command string |
|
| 118 |
+} |
|
| 119 |
+ |
|
| 120 |
+func makeTestContainer(c *check.C, options testContainerOptions) (containerID string) {
|
|
| 121 |
+ if options.addContent {
|
|
| 122 |
+ mkContentCmd := defaultMkContentCommand() |
|
| 123 |
+ if options.command == "" {
|
|
| 124 |
+ options.command = mkContentCmd |
|
| 125 |
+ } else {
|
|
| 126 |
+ options.command = fmt.Sprintf("%s && %s", defaultMkContentCommand(), options.command)
|
|
| 127 |
+ } |
|
| 128 |
+ } |
|
| 129 |
+ |
|
| 130 |
+ if options.command == "" {
|
|
| 131 |
+ options.command = "#(nop)" |
|
| 132 |
+ } |
|
| 133 |
+ |
|
| 134 |
+ args := []string{"run", "-d"}
|
|
| 135 |
+ |
|
| 136 |
+ for _, volume := range options.volumes {
|
|
| 137 |
+ args = append(args, "-v", volume) |
|
| 138 |
+ } |
|
| 139 |
+ |
|
| 140 |
+ if options.workDir != "" {
|
|
| 141 |
+ args = append(args, "-w", options.workDir) |
|
| 142 |
+ } |
|
| 143 |
+ |
|
| 144 |
+ if options.readOnly {
|
|
| 145 |
+ args = append(args, "--read-only") |
|
| 146 |
+ } |
|
| 147 |
+ |
|
| 148 |
+ args = append(args, "busybox", "/bin/sh", "-c", options.command) |
|
| 149 |
+ |
|
| 150 |
+ out, _ := dockerCmd(c, args...) |
|
| 151 |
+ |
|
| 152 |
+ containerID = strings.TrimSpace(out) |
|
| 153 |
+ |
|
| 154 |
+ out, _ = dockerCmd(c, "wait", containerID) |
|
| 155 |
+ |
|
| 156 |
+ exitCode := strings.TrimSpace(out) |
|
| 157 |
+ if exitCode != "0" {
|
|
| 158 |
+ out, _ = dockerCmd(c, "logs", containerID) |
|
| 159 |
+ } |
|
| 160 |
+ c.Assert(exitCode, checker.Equals, "0", check.Commentf("failed to make test container: %s", out))
|
|
| 161 |
+ |
|
| 162 |
+ return |
|
| 163 |
+} |
|
| 164 |
+ |
|
| 165 |
+func makeCatFileCommand(path string) string {
|
|
| 166 |
+ return fmt.Sprintf("if [ -f %s ]; then cat %s; fi", path, path)
|
|
| 167 |
+} |
|
| 168 |
+ |
|
| 169 |
+func cpPath(pathElements ...string) string {
|
|
| 170 |
+ localizedPathElements := make([]string, len(pathElements)) |
|
| 171 |
+ for i, path := range pathElements {
|
|
| 172 |
+ localizedPathElements[i] = filepath.FromSlash(path) |
|
| 173 |
+ } |
|
| 174 |
+ return strings.Join(localizedPathElements, string(filepath.Separator)) |
|
| 175 |
+} |
|
| 176 |
+ |
|
| 177 |
+func cpPathTrailingSep(pathElements ...string) string {
|
|
| 178 |
+ return fmt.Sprintf("%s%c", cpPath(pathElements...), filepath.Separator)
|
|
| 179 |
+} |
|
| 180 |
+ |
|
| 181 |
+func containerCpPath(containerID string, pathElements ...string) string {
|
|
| 182 |
+ joined := strings.Join(pathElements, "/") |
|
| 183 |
+ return fmt.Sprintf("%s:%s", containerID, joined)
|
|
| 184 |
+} |
|
| 185 |
+ |
|
| 186 |
+func containerCpPathTrailingSep(containerID string, pathElements ...string) string {
|
|
| 187 |
+ return fmt.Sprintf("%s/", containerCpPath(containerID, pathElements...))
|
|
| 188 |
+} |
|
| 189 |
+ |
|
| 190 |
+func runDockerCp(c *check.C, src, dst string, params []string) (err error) {
|
|
| 191 |
+ c.Logf("running `docker cp %s %s %s`", strings.Join(params, " "), src, dst)
|
|
| 192 |
+ |
|
| 193 |
+ args := []string{"cp"}
|
|
| 194 |
+ |
|
| 195 |
+ for _, param := range params {
|
|
| 196 |
+ args = append(args, param) |
|
| 197 |
+ } |
|
| 198 |
+ |
|
| 199 |
+ args = append(args, src, dst) |
|
| 200 |
+ |
|
| 201 |
+ out, _, err := runCommandWithOutput(exec.Command(dockerBinary, args...)) |
|
| 202 |
+ if err != nil {
|
|
| 203 |
+ err = fmt.Errorf("error executing `docker cp` command: %s: %s", err, out)
|
|
| 204 |
+ } |
|
| 205 |
+ |
|
| 206 |
+ return |
|
| 207 |
+} |
|
| 208 |
+ |
|
| 209 |
+func startContainerGetOutput(c *check.C, containerID string) (out string, err error) {
|
|
| 210 |
+ c.Logf("running `docker start -a %s`", containerID)
|
|
| 211 |
+ |
|
| 212 |
+ args := []string{"start", "-a", containerID}
|
|
| 213 |
+ |
|
| 214 |
+ out, _, err = runCommandWithOutput(exec.Command(dockerBinary, args...)) |
|
| 215 |
+ if err != nil {
|
|
| 216 |
+ err = fmt.Errorf("error executing `docker start` command: %s: %s", err, out)
|
|
| 217 |
+ } |
|
| 218 |
+ |
|
| 219 |
+ return |
|
| 220 |
+} |
|
| 221 |
+ |
|
| 222 |
+func getTestDir(c *check.C, label string) (tmpDir string) {
|
|
| 223 |
+ var err error |
|
| 224 |
+ |
|
| 225 |
+ tmpDir, err = ioutil.TempDir("", label)
|
|
| 226 |
+ // unable to make temporary directory |
|
| 227 |
+ c.Assert(err, checker.IsNil) |
|
| 228 |
+ |
|
| 229 |
+ return |
|
| 230 |
+} |
|
| 231 |
+ |
|
| 232 |
+func isCpNotExist(err error) bool {
|
|
| 233 |
+ return strings.Contains(err.Error(), "no such file or directory") || strings.Contains(err.Error(), "cannot find the file specified") |
|
| 234 |
+} |
|
| 235 |
+ |
|
| 236 |
+func isCpDirNotExist(err error) bool {
|
|
| 237 |
+ return strings.Contains(err.Error(), archive.ErrDirNotExists.Error()) |
|
| 238 |
+} |
|
| 239 |
+ |
|
| 240 |
+func isCpNotDir(err error) bool {
|
|
| 241 |
+ return strings.Contains(err.Error(), archive.ErrNotDirectory.Error()) || strings.Contains(err.Error(), "filename, directory name, or volume label syntax is incorrect") |
|
| 242 |
+} |
|
| 243 |
+ |
|
| 244 |
+func isCpCannotCopyDir(err error) bool {
|
|
| 245 |
+ return strings.Contains(err.Error(), archive.ErrCannotCopyDir.Error()) |
|
| 246 |
+} |
|
| 247 |
+ |
|
| 248 |
+func isCpCannotCopyReadOnly(err error) bool {
|
|
| 249 |
+ return strings.Contains(err.Error(), "marked read-only") |
|
| 250 |
+} |
|
| 251 |
+ |
|
| 252 |
+func isCannotOverwriteNonDirWithDir(err error) bool {
|
|
| 253 |
+ return strings.Contains(err.Error(), "cannot overwrite non-directory") |
|
| 254 |
+} |
|
| 255 |
+ |
|
| 256 |
+func fileContentEquals(c *check.C, filename, contents string) (err error) {
|
|
| 257 |
+ c.Logf("checking that file %q contains %q\n", filename, contents)
|
|
| 258 |
+ |
|
| 259 |
+ fileBytes, err := ioutil.ReadFile(filename) |
|
| 260 |
+ if err != nil {
|
|
| 261 |
+ return |
|
| 262 |
+ } |
|
| 263 |
+ |
|
| 264 |
+ expectedBytes, err := ioutil.ReadAll(strings.NewReader(contents)) |
|
| 265 |
+ if err != nil {
|
|
| 266 |
+ return |
|
| 267 |
+ } |
|
| 268 |
+ |
|
| 269 |
+ if !bytes.Equal(fileBytes, expectedBytes) {
|
|
| 270 |
+ err = fmt.Errorf("file content not equal - expected %q, got %q", string(expectedBytes), string(fileBytes))
|
|
| 271 |
+ } |
|
| 272 |
+ |
|
| 273 |
+ return |
|
| 274 |
+} |
|
| 275 |
+ |
|
| 276 |
+func symlinkTargetEquals(c *check.C, symlink, expectedTarget string) (err error) {
|
|
| 277 |
+ c.Logf("checking that the symlink %q points to %q\n", symlink, expectedTarget)
|
|
| 278 |
+ |
|
| 279 |
+ actualTarget, err := os.Readlink(symlink) |
|
| 280 |
+ if err != nil {
|
|
| 281 |
+ return |
|
| 282 |
+ } |
|
| 283 |
+ |
|
| 284 |
+ if actualTarget != expectedTarget {
|
|
| 285 |
+ err = fmt.Errorf("symlink target points to %q not %q", actualTarget, expectedTarget)
|
|
| 286 |
+ } |
|
| 287 |
+ |
|
| 288 |
+ return |
|
| 289 |
+} |
|
| 290 |
+ |
|
| 291 |
+func containerStartOutputEquals(c *check.C, containerID, contents string) (err error) {
|
|
| 292 |
+ c.Logf("checking that container %q start output contains %q\n", containerID, contents)
|
|
| 293 |
+ |
|
| 294 |
+ out, err := startContainerGetOutput(c, containerID) |
|
| 295 |
+ if err != nil {
|
|
| 296 |
+ return |
|
| 297 |
+ } |
|
| 298 |
+ |
|
| 299 |
+ if out != contents {
|
|
| 300 |
+ err = fmt.Errorf("output contents not equal - expected %q, got %q", contents, out)
|
|
| 301 |
+ } |
|
| 302 |
+ |
|
| 303 |
+ return |
|
| 304 |
+} |
|
| 305 |
+ |
|
| 306 |
+func defaultVolumes(tmpDir string) []string {
|
|
| 307 |
+ if SameHostDaemon() {
|
|
| 308 |
+ return []string{
|
|
| 309 |
+ "/vol1", |
|
| 310 |
+ fmt.Sprintf("%s:/vol2", tmpDir),
|
|
| 311 |
+ fmt.Sprintf("%s:/vol3", filepath.Join(tmpDir, "vol3")),
|
|
| 312 |
+ fmt.Sprintf("%s:/vol_ro:ro", filepath.Join(tmpDir, "vol_ro")),
|
|
| 313 |
+ } |
|
| 314 |
+ } |
|
| 315 |
+ |
|
| 316 |
+ // Can't bind-mount volumes with separate host daemon. |
|
| 317 |
+ return []string{"/vol1", "/vol2", "/vol3", "/vol_ro:/vol_ro:ro"}
|
|
| 318 |
+} |
| ... | ... |
@@ -452,7 +452,7 @@ func (s *DockerSuite) TestEventsCommit(c *check.C) {
|
| 452 | 452 |
// Problematic on Windows as cannot commit a running container |
| 453 | 453 |
testRequires(c, DaemonIsLinux) |
| 454 | 454 |
|
| 455 |
- out, _ := runSleepingContainer(c) |
|
| 455 |
+ out := runSleepingContainer(c) |
|
| 456 | 456 |
cID := strings.TrimSpace(out) |
| 457 | 457 |
cli.WaitRun(c, cID) |
| 458 | 458 |
|
| ... | ... |
@@ -495,7 +495,7 @@ func (s *DockerSuite) TestEventsCopy(c *check.C) {
|
| 495 | 495 |
} |
| 496 | 496 |
|
| 497 | 497 |
func (s *DockerSuite) TestEventsResize(c *check.C) {
|
| 498 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 498 |
+ out := runSleepingContainer(c, "-d") |
|
| 499 | 499 |
cID := strings.TrimSpace(out) |
| 500 | 500 |
c.Assert(waitRun(cID), checker.IsNil) |
| 501 | 501 |
|
| ... | ... |
@@ -561,7 +561,7 @@ func (s *DockerSuite) TestEventsTop(c *check.C) {
|
| 561 | 561 |
// Problematic on Windows as Windows does not support top |
| 562 | 562 |
testRequires(c, DaemonIsLinux) |
| 563 | 563 |
|
| 564 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 564 |
+ out := runSleepingContainer(c, "-d") |
|
| 565 | 565 |
cID := strings.TrimSpace(out) |
| 566 | 566 |
c.Assert(waitRun(cID), checker.IsNil) |
| 567 | 567 |
|
| ... | ... |
@@ -71,7 +71,7 @@ func (s *DockerSuite) TestExecInteractive(c *check.C) {
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
func (s *DockerSuite) TestExecAfterContainerRestart(c *check.C) {
|
| 74 |
- out, _ := runSleepingContainer(c) |
|
| 74 |
+ out := runSleepingContainer(c) |
|
| 75 | 75 |
cleanedContainerID := strings.TrimSpace(out) |
| 76 | 76 |
c.Assert(waitRun(cleanedContainerID), check.IsNil) |
| 77 | 77 |
dockerCmd(c, "restart", cleanedContainerID) |
| ... | ... |
@@ -139,7 +139,7 @@ func (s *DockerSuite) TestExecExitStatus(c *check.C) {
|
| 139 | 139 |
func (s *DockerSuite) TestExecPausedContainer(c *check.C) {
|
| 140 | 140 |
testRequires(c, IsPausable) |
| 141 | 141 |
|
| 142 |
- out, _ := runSleepingContainer(c, "-d", "--name", "testing") |
|
| 142 |
+ out := runSleepingContainer(c, "-d", "--name", "testing") |
|
| 143 | 143 |
ContainerID := strings.TrimSpace(out) |
| 144 | 144 |
|
| 145 | 145 |
dockerCmd(c, "pause", "testing") |
| ... | ... |
@@ -305,7 +305,7 @@ func (s *DockerSuite) TestExecCgroup(c *check.C) {
|
| 305 | 305 |
} |
| 306 | 306 |
|
| 307 | 307 |
func (s *DockerSuite) TestExecInspectID(c *check.C) {
|
| 308 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 308 |
+ out := runSleepingContainer(c, "-d") |
|
| 309 | 309 |
id := strings.TrimSuffix(out, "\n") |
| 310 | 310 |
|
| 311 | 311 |
out = inspectField(c, id, "ExecIDs") |
| ... | ... |
@@ -146,7 +146,7 @@ func (s *DockerSuite) TestInfoDisplaysRunningContainers(c *check.C) {
|
| 146 | 146 |
func (s *DockerSuite) TestInfoDisplaysPausedContainers(c *check.C) {
|
| 147 | 147 |
testRequires(c, IsPausable) |
| 148 | 148 |
|
| 149 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 149 |
+ out := runSleepingContainer(c, "-d") |
|
| 150 | 150 |
cleanedContainerID := strings.TrimSpace(out) |
| 151 | 151 |
|
| 152 | 152 |
dockerCmd(c, "pause", cleanedContainerID) |
| ... | ... |
@@ -53,7 +53,7 @@ func (s *DockerSuite) TestInspectDefault(c *check.C) {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
func (s *DockerSuite) TestInspectStatus(c *check.C) {
|
| 56 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 56 |
+ out := runSleepingContainer(c, "-d") |
|
| 57 | 57 |
out = strings.TrimSpace(out) |
| 58 | 58 |
|
| 59 | 59 |
inspectOut := inspectField(c, out, "State.Status") |
| ... | ... |
@@ -14,7 +14,7 @@ import ( |
| 14 | 14 |
) |
| 15 | 15 |
|
| 16 | 16 |
func (s *DockerSuite) TestKillContainer(c *check.C) {
|
| 17 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 17 |
+ out := runSleepingContainer(c, "-d") |
|
| 18 | 18 |
cleanedContainerID := strings.TrimSpace(out) |
| 19 | 19 |
cli.WaitRun(c, cleanedContainerID) |
| 20 | 20 |
|
| ... | ... |
@@ -27,7 +27,7 @@ func (s *DockerSuite) TestKillContainer(c *check.C) {
|
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 | 29 |
func (s *DockerSuite) TestKillOffStoppedContainer(c *check.C) {
|
| 30 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 30 |
+ out := runSleepingContainer(c, "-d") |
|
| 31 | 31 |
cleanedContainerID := strings.TrimSpace(out) |
| 32 | 32 |
|
| 33 | 33 |
cli.DockerCmd(c, "stop", cleanedContainerID) |
| ... | ... |
@@ -103,7 +103,7 @@ func (s *DockerSuite) TestKillWithStopSignalWithDifferentSignalShouldKeepRestart |
| 103 | 103 |
|
| 104 | 104 |
// FIXME(vdemeester) should be a unit test |
| 105 | 105 |
func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
|
| 106 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 106 |
+ out := runSleepingContainer(c, "-d") |
|
| 107 | 107 |
cid := strings.TrimSpace(out) |
| 108 | 108 |
c.Assert(waitRun(cid), check.IsNil) |
| 109 | 109 |
|
| ... | ... |
@@ -114,7 +114,7 @@ func (s *DockerSuite) TestKillWithInvalidSignal(c *check.C) {
|
| 114 | 114 |
running := inspectField(c, cid, "State.Running") |
| 115 | 115 |
c.Assert(running, checker.Equals, "true", check.Commentf("Container should be in running state after an invalid signal"))
|
| 116 | 116 |
|
| 117 |
- out, _ = runSleepingContainer(c, "-d") |
|
| 117 |
+ out = runSleepingContainer(c, "-d") |
|
| 118 | 118 |
cid = strings.TrimSpace(out) |
| 119 | 119 |
c.Assert(waitRun(cid), check.IsNil) |
| 120 | 120 |
|
| ... | ... |
@@ -334,7 +334,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkCreateHostBind(c *check.C) {
|
| 334 | 334 |
dockerCmd(c, "network", "create", "--subnet=192.168.10.0/24", "--gateway=192.168.10.1", "-o", "com.docker.network.bridge.host_binding_ipv4=192.168.10.1", "testbind") |
| 335 | 335 |
assertNwIsAvailable(c, "testbind") |
| 336 | 336 |
|
| 337 |
- out, _ := runSleepingContainer(c, "--net=testbind", "-p", "5000:5000") |
|
| 337 |
+ out := runSleepingContainer(c, "--net=testbind", "-p", "5000:5000") |
|
| 338 | 338 |
id := strings.TrimSpace(out) |
| 339 | 339 |
c.Assert(waitRun(id), checker.IsNil) |
| 340 | 340 |
out, _ = dockerCmd(c, "ps") |
| ... | ... |
@@ -19,17 +19,17 @@ import ( |
| 19 | 19 |
) |
| 20 | 20 |
|
| 21 | 21 |
func (s *DockerSuite) TestPsListContainersBase(c *check.C) {
|
| 22 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 22 |
+ out := runSleepingContainer(c, "-d") |
|
| 23 | 23 |
firstID := strings.TrimSpace(out) |
| 24 | 24 |
|
| 25 |
- out, _ = runSleepingContainer(c, "-d") |
|
| 25 |
+ out = runSleepingContainer(c, "-d") |
|
| 26 | 26 |
secondID := strings.TrimSpace(out) |
| 27 | 27 |
|
| 28 | 28 |
// not long running |
| 29 | 29 |
out, _ = dockerCmd(c, "run", "-d", "busybox", "true") |
| 30 | 30 |
thirdID := strings.TrimSpace(out) |
| 31 | 31 |
|
| 32 |
- out, _ = runSleepingContainer(c, "-d") |
|
| 32 |
+ out = runSleepingContainer(c, "-d") |
|
| 33 | 33 |
fourthID := strings.TrimSpace(out) |
| 34 | 34 |
|
| 35 | 35 |
// make sure the second is running |
| ... | ... |
@@ -228,7 +228,7 @@ func (s *DockerSuite) TestPsListContainersFilterStatus(c *check.C) {
|
| 228 | 228 |
|
| 229 | 229 |
func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
|
| 230 | 230 |
// Test legacy no health check |
| 231 |
- out, _ := runSleepingContainer(c, "--name=none_legacy") |
|
| 231 |
+ out := runSleepingContainer(c, "--name=none_legacy") |
|
| 232 | 232 |
containerID := strings.TrimSpace(out) |
| 233 | 233 |
|
| 234 | 234 |
cli.WaitRun(c, containerID) |
| ... | ... |
@@ -238,7 +238,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
|
| 238 | 238 |
c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected id %s, got %s for legacy none filter, output: %q", containerID, containerOut, out))
|
| 239 | 239 |
|
| 240 | 240 |
// Test no health check specified explicitly |
| 241 |
- out, _ = runSleepingContainer(c, "--name=none", "--no-healthcheck") |
|
| 241 |
+ out = runSleepingContainer(c, "--name=none", "--no-healthcheck") |
|
| 242 | 242 |
containerID = strings.TrimSpace(out) |
| 243 | 243 |
|
| 244 | 244 |
cli.WaitRun(c, containerID) |
| ... | ... |
@@ -248,7 +248,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
|
| 248 | 248 |
c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected id %s, got %s for none filter, output: %q", containerID, containerOut, out))
|
| 249 | 249 |
|
| 250 | 250 |
// Test failing health check |
| 251 |
- out, _ = runSleepingContainer(c, "--name=failing_container", "--health-cmd=exit 1", "--health-interval=1s") |
|
| 251 |
+ out = runSleepingContainer(c, "--name=failing_container", "--health-cmd=exit 1", "--health-interval=1s") |
|
| 252 | 252 |
containerID = strings.TrimSpace(out) |
| 253 | 253 |
|
| 254 | 254 |
waitForHealthStatus(c, "failing_container", "starting", "unhealthy") |
| ... | ... |
@@ -258,7 +258,7 @@ func (s *DockerSuite) TestPsListContainersFilterHealth(c *check.C) {
|
| 258 | 258 |
c.Assert(containerOut, checker.Equals, containerID, check.Commentf("Expected containerID %s, got %s for unhealthy filter, output: %q", containerID, containerOut, out))
|
| 259 | 259 |
|
| 260 | 260 |
// Check passing healthcheck |
| 261 |
- out, _ = runSleepingContainer(c, "--name=passing_container", "--health-cmd=exit 0", "--health-interval=1s") |
|
| 261 |
+ out = runSleepingContainer(c, "--name=passing_container", "--health-cmd=exit 0", "--health-interval=1s") |
|
| 262 | 262 |
containerID = strings.TrimSpace(out) |
| 263 | 263 |
|
| 264 | 264 |
waitForHealthStatus(c, "passing_container", "starting", "healthy") |
| ... | ... |
@@ -473,11 +473,11 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
|
| 473 | 473 |
dockerCmd(c, "tag", "busybox", tag) |
| 474 | 474 |
|
| 475 | 475 |
var id1 string |
| 476 |
- out, _ := runSleepingContainer(c) |
|
| 476 |
+ out := runSleepingContainer(c) |
|
| 477 | 477 |
id1 = strings.TrimSpace(string(out)) |
| 478 | 478 |
|
| 479 | 479 |
var id2 string |
| 480 |
- out, _ = runSleepingContainerInImage(c, tag) |
|
| 480 |
+ out = runSleepingContainerInImage(c, tag) |
|
| 481 | 481 |
id2 = strings.TrimSpace(string(out)) |
| 482 | 482 |
|
| 483 | 483 |
var imageID string |
| ... | ... |
@@ -485,7 +485,7 @@ func (s *DockerSuite) TestPsRightTagName(c *check.C) {
|
| 485 | 485 |
imageID = strings.TrimSpace(string(out)) |
| 486 | 486 |
|
| 487 | 487 |
var id3 string |
| 488 |
- out, _ = runSleepingContainerInImage(c, imageID) |
|
| 488 |
+ out = runSleepingContainerInImage(c, imageID) |
|
| 489 | 489 |
id3 = strings.TrimSpace(string(out)) |
| 490 | 490 |
|
| 491 | 491 |
out, _ = dockerCmd(c, "ps", "--no-trunc") |
| ... | ... |
@@ -638,7 +638,7 @@ func (s *DockerSuite) TestPsDefaultFormatAndQuiet(c *check.C) {
|
| 638 | 638 |
err = ioutil.WriteFile(filepath.Join(d, "config.json"), []byte(config), 0644) |
| 639 | 639 |
c.Assert(err, checker.IsNil) |
| 640 | 640 |
|
| 641 |
- out, _ := runSleepingContainer(c, "--name=test") |
|
| 641 |
+ out := runSleepingContainer(c, "--name=test") |
|
| 642 | 642 |
id := strings.TrimSpace(out) |
| 643 | 643 |
|
| 644 | 644 |
out, _ = dockerCmd(c, "--config", d, "ps", "-q") |
| ... | ... |
@@ -898,35 +898,25 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
| 898 | 898 |
|
| 899 | 899 |
func (s *DockerSuite) TestPsByOrder(c *check.C) {
|
| 900 | 900 |
name1 := "xyz-abc" |
| 901 |
- out, err := runSleepingContainer(c, "--name", name1) |
|
| 902 |
- c.Assert(err, checker.NotNil) |
|
| 903 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") |
|
| 901 |
+ out := runSleepingContainer(c, "--name", name1) |
|
| 904 | 902 |
container1 := strings.TrimSpace(out) |
| 905 | 903 |
|
| 906 | 904 |
name2 := "xyz-123" |
| 907 |
- out, err = runSleepingContainer(c, "--name", name2) |
|
| 908 |
- c.Assert(err, checker.NotNil) |
|
| 909 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") |
|
| 905 |
+ out = runSleepingContainer(c, "--name", name2) |
|
| 910 | 906 |
container2 := strings.TrimSpace(out) |
| 911 | 907 |
|
| 912 | 908 |
name3 := "789-abc" |
| 913 |
- out, err = runSleepingContainer(c, "--name", name3) |
|
| 914 |
- c.Assert(err, checker.NotNil) |
|
| 915 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") |
|
| 909 |
+ out = runSleepingContainer(c, "--name", name3) |
|
| 916 | 910 |
|
| 917 | 911 |
name4 := "789-123" |
| 918 |
- out, err = runSleepingContainer(c, "--name", name4) |
|
| 919 |
- c.Assert(err, checker.NotNil) |
|
| 920 |
- c.Assert(strings.TrimSpace(out), checker.Not(checker.Equals), "") |
|
| 912 |
+ out = runSleepingContainer(c, "--name", name4) |
|
| 921 | 913 |
|
| 922 | 914 |
// Run multiple time should have the same result |
| 923 |
- out, err = dockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz") |
|
| 924 |
- c.Assert(err, checker.NotNil) |
|
| 915 |
+ out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz").Combined() |
|
| 925 | 916 |
c.Assert(strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%s\n%s", container2, container1))
|
| 926 | 917 |
|
| 927 | 918 |
// Run multiple time should have the same result |
| 928 |
- out, err = dockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz") |
|
| 929 |
- c.Assert(err, checker.NotNil) |
|
| 919 |
+ out = cli.DockerCmd(c, "ps", "--no-trunc", "-q", "-f", "name=xyz").Combined() |
|
| 930 | 920 |
c.Assert(strings.TrimSpace(out), checker.Equals, fmt.Sprintf("%s\n%s", container2, container1))
|
| 931 | 921 |
} |
| 932 | 922 |
|
| ... | ... |
@@ -36,7 +36,7 @@ func (s *DockerSuite) TestRenameRunningContainer(c *check.C) {
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
func (s *DockerSuite) TestRenameRunningContainerAndReuse(c *check.C) {
|
| 39 |
- out, _ := runSleepingContainer(c, "--name", "first_name") |
|
| 39 |
+ out := runSleepingContainer(c, "--name", "first_name") |
|
| 40 | 40 |
c.Assert(waitRun("first_name"), check.IsNil)
|
| 41 | 41 |
|
| 42 | 42 |
newName := "new_name" |
| ... | ... |
@@ -46,7 +46,7 @@ func (s *DockerSuite) TestRenameRunningContainerAndReuse(c *check.C) {
|
| 46 | 46 |
name := inspectField(c, ContainerID, "Name") |
| 47 | 47 |
c.Assert(name, checker.Equals, "/"+newName, check.Commentf("Failed to rename container"))
|
| 48 | 48 |
|
| 49 |
- out, _ = runSleepingContainer(c, "--name", "first_name") |
|
| 49 |
+ out = runSleepingContainer(c, "--name", "first_name") |
|
| 50 | 50 |
c.Assert(waitRun("first_name"), check.IsNil)
|
| 51 | 51 |
newContainerID := strings.TrimSpace(out) |
| 52 | 52 |
name = inspectField(c, newContainerID, "Name") |
| ... | ... |
@@ -113,7 +113,7 @@ func (s *DockerSuite) TestRenameAnonymousContainer(c *check.C) {
|
| 113 | 113 |
} |
| 114 | 114 |
|
| 115 | 115 |
func (s *DockerSuite) TestRenameContainerWithSameName(c *check.C) {
|
| 116 |
- out, _ := runSleepingContainer(c, "--name", "old") |
|
| 116 |
+ out := runSleepingContainer(c, "--name", "old") |
|
| 117 | 117 |
ContainerID := strings.TrimSpace(out) |
| 118 | 118 |
|
| 119 | 119 |
out, _, err := dockerCmdWithError("rename", "old", "old")
|
| ... | ... |
@@ -52,7 +52,7 @@ func (s *DockerSuite) TestRestartRunningContainer(c *check.C) {
|
| 52 | 52 |
// Test that restarting a container with a volume does not create a new volume on restart. Regression test for #819. |
| 53 | 53 |
func (s *DockerSuite) TestRestartWithVolumes(c *check.C) {
|
| 54 | 54 |
prefix, slash := getPrefixAndSlashFromDaemonPlatform() |
| 55 |
- out, _ := runSleepingContainer(c, "-d", "-v", prefix+slash+"test") |
|
| 55 |
+ out := runSleepingContainer(c, "-d", "-v", prefix+slash+"test") |
|
| 56 | 56 |
|
| 57 | 57 |
cleanedContainerID := strings.TrimSpace(out) |
| 58 | 58 |
out, err := inspectFilter(cleanedContainerID, "len .Mounts") |
| ... | ... |
@@ -166,7 +166,7 @@ func (s *DockerSuite) TestRestartContainerwithGoodContainer(c *check.C) {
|
| 166 | 166 |
func (s *DockerSuite) TestRestartContainerSuccess(c *check.C) {
|
| 167 | 167 |
testRequires(c, SameHostDaemon) |
| 168 | 168 |
|
| 169 |
- out, _ := runSleepingContainer(c, "-d", "--restart=always") |
|
| 169 |
+ out := runSleepingContainer(c, "-d", "--restart=always") |
|
| 170 | 170 |
id := strings.TrimSpace(out) |
| 171 | 171 |
c.Assert(waitRun(id), check.IsNil) |
| 172 | 172 |
|
| ... | ... |
@@ -235,7 +235,7 @@ func (s *DockerSuite) TestRestartWithPolicyUserDefinedNetwork(c *check.C) {
|
| 235 | 235 |
func (s *DockerSuite) TestRestartPolicyAfterRestart(c *check.C) {
|
| 236 | 236 |
testRequires(c, SameHostDaemon) |
| 237 | 237 |
|
| 238 |
- out, _ := runSleepingContainer(c, "-d", "--restart=always") |
|
| 238 |
+ out := runSleepingContainer(c, "-d", "--restart=always") |
|
| 239 | 239 |
id := strings.TrimSpace(out) |
| 240 | 240 |
c.Assert(waitRun(id), check.IsNil) |
| 241 | 241 |
|
| ... | ... |
@@ -294,7 +294,7 @@ func (s *DockerSuite) TestRestartContainerwithRestartPolicy(c *check.C) {
|
| 294 | 294 |
} |
| 295 | 295 |
|
| 296 | 296 |
func (s *DockerSuite) TestRestartAutoRemoveContainer(c *check.C) {
|
| 297 |
- out, _ := runSleepingContainer(c, "--rm") |
|
| 297 |
+ out := runSleepingContainer(c, "--rm") |
|
| 298 | 298 |
|
| 299 | 299 |
id := strings.TrimSpace(string(out)) |
| 300 | 300 |
dockerCmd(c, "restart", id) |
| ... | ... |
@@ -85,7 +85,7 @@ func (s *DockerSuite) TestRmiImgIDMultipleTag(c *check.C) {
|
| 85 | 85 |
imgID := inspectField(c, "busybox-one:tag1", "Id") |
| 86 | 86 |
|
| 87 | 87 |
// run a container with the image |
| 88 |
- out, _ = runSleepingContainerInImage(c, "busybox-one") |
|
| 88 |
+ out = runSleepingContainerInImage(c, "busybox-one") |
|
| 89 | 89 |
containerID = strings.TrimSpace(out) |
| 90 | 90 |
|
| 91 | 91 |
// first checkout without force it fails |
| ... | ... |
@@ -147,7 +147,7 @@ func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
|
| 147 | 147 |
} |
| 148 | 148 |
}() |
| 149 | 149 |
|
| 150 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 150 |
+ out := runSleepingContainer(c, "-d") |
|
| 151 | 151 |
c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil) |
| 152 | 152 |
id <- strings.TrimSpace(out)[:12] |
| 153 | 153 |
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
|
| 12 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 12 |
+ out := runSleepingContainer(c, "-d") |
|
| 13 | 13 |
cleanedContainerID := strings.TrimSpace(out) |
| 14 | 14 |
|
| 15 | 15 |
var expected icmd.Expected |
| ... | ... |
@@ -24,7 +24,7 @@ func (s *DockerSuite) TestTopMultipleArgs(c *check.C) {
|
| 24 | 24 |
} |
| 25 | 25 |
|
| 26 | 26 |
func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
|
| 27 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 27 |
+ out := runSleepingContainer(c, "-d") |
|
| 28 | 28 |
cleanedContainerID := strings.TrimSpace(out) |
| 29 | 29 |
|
| 30 | 30 |
out1, _ := dockerCmd(c, "top", cleanedContainerID) |
| ... | ... |
@@ -49,7 +49,7 @@ func (s *DockerSuite) TestTopNonPrivileged(c *check.C) {
|
| 49 | 49 |
// very different to Linux in this regard. |
| 50 | 50 |
func (s *DockerSuite) TestTopWindowsCoreProcesses(c *check.C) {
|
| 51 | 51 |
testRequires(c, DaemonIsWindows) |
| 52 |
- out, _ := runSleepingContainer(c, "-d") |
|
| 52 |
+ out := runSleepingContainer(c, "-d") |
|
| 53 | 53 |
cleanedContainerID := strings.TrimSpace(out) |
| 54 | 54 |
out1, _ := dockerCmd(c, "top", cleanedContainerID) |
| 55 | 55 |
lookingFor := []string{"smss.exe", "csrss.exe", "wininit.exe", "services.exe", "lsass.exe", "CExecSvc.exe"}
|
| ... | ... |
@@ -32,7 +32,7 @@ func (s *DockerSuite) TestUpdateRestartPolicy(c *check.C) {
|
| 32 | 32 |
} |
| 33 | 33 |
|
| 34 | 34 |
func (s *DockerSuite) TestUpdateRestartWithAutoRemoveFlag(c *check.C) {
|
| 35 |
- out, _ := runSleepingContainer(c, "--rm") |
|
| 35 |
+ out := runSleepingContainer(c, "--rm") |
|
| 36 | 36 |
id := strings.TrimSpace(out) |
| 37 | 37 |
|
| 38 | 38 |
// update restart policy for an AutoRemove container |
| ... | ... |
@@ -487,18 +487,18 @@ func getInspectBody(c *check.C, version, id string) []byte {
|
| 487 | 487 |
|
| 488 | 488 |
// Run a long running idle task in a background container using the |
| 489 | 489 |
// system-specific default image and command. |
| 490 |
-func runSleepingContainer(c *check.C, extraArgs ...string) (string, int) {
|
|
| 490 |
+func runSleepingContainer(c *check.C, extraArgs ...string) string {
|
|
| 491 | 491 |
return runSleepingContainerInImage(c, defaultSleepImage, extraArgs...) |
| 492 | 492 |
} |
| 493 | 493 |
|
| 494 | 494 |
// Run a long running idle task in a background container using the specified |
| 495 | 495 |
// image and the system-specific command. |
| 496 |
-func runSleepingContainerInImage(c *check.C, image string, extraArgs ...string) (string, int) {
|
|
| 496 |
+func runSleepingContainerInImage(c *check.C, image string, extraArgs ...string) string {
|
|
| 497 | 497 |
args := []string{"run", "-d"}
|
| 498 | 498 |
args = append(args, extraArgs...) |
| 499 | 499 |
args = append(args, image) |
| 500 | 500 |
args = append(args, sleepCommandForDaemonPlatform()...) |
| 501 |
- return dockerCmd(c, args...) |
|
| 501 |
+ return cli.DockerCmd(c, args...).Combined() |
|
| 502 | 502 |
} |
| 503 | 503 |
|
| 504 | 504 |
// minimalBaseImage returns the name of the minimal base image for the current |