Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
| ... | ... |
@@ -141,8 +141,6 @@ func TestRunPingGoogle(t *testing.T) {
|
| 141 | 141 |
t.Fatalf("failed to run container: %v, output: %q", err, out)
|
| 142 | 142 |
} |
| 143 | 143 |
|
| 144 |
- errorOut(err, t, "container should've been able to ping 8.8.8.8") |
|
| 145 |
- |
|
| 146 | 144 |
deleteAllContainers() |
| 147 | 145 |
|
| 148 | 146 |
logDone("run - ping 8.8.8.8")
|
| ... | ... |
@@ -152,11 +150,8 @@ func TestRunPingGoogle(t *testing.T) {
|
| 152 | 152 |
// some versions of lxc might make this test fail |
| 153 | 153 |
func TestRunExitCodeZero(t *testing.T) {
|
| 154 | 154 |
runCmd := exec.Command(dockerBinary, "run", "busybox", "true") |
| 155 |
- exitCode, err := runCommand(runCmd) |
|
| 156 |
- errorOut(err, t, fmt.Sprintf("%s", err))
|
|
| 157 |
- |
|
| 158 |
- if exitCode != 0 {
|
|
| 159 |
- t.Errorf("container should've exited with exit code 0")
|
|
| 155 |
+ if out, _, err := runCommandWithOutput(runCmd); err != nil {
|
|
| 156 |
+ t.Errorf("container should've exited with exit code 0: %s, %v", out, err)
|
|
| 160 | 157 |
} |
| 161 | 158 |
|
| 162 | 159 |
deleteAllContainers() |
| ... | ... |
@@ -193,26 +188,31 @@ func TestRunStdinPipe(t *testing.T) {
|
| 193 | 193 |
out = stripTrailingCharacters(out) |
| 194 | 194 |
|
| 195 | 195 |
inspectCmd := exec.Command(dockerBinary, "inspect", out) |
| 196 |
- inspectOut, _, err := runCommandWithOutput(inspectCmd) |
|
| 197 |
- errorOut(err, t, fmt.Sprintf("out should've been a container id: %s %s", out, inspectOut))
|
|
| 196 |
+ if out, _, err := runCommandWithOutput(inspectCmd); err != nil {
|
|
| 197 |
+ t.Fatalf("out should've been a container id: %s %v", out, err)
|
|
| 198 |
+ } |
|
| 198 | 199 |
|
| 199 | 200 |
waitCmd := exec.Command(dockerBinary, "wait", out) |
| 200 |
- _, _, err = runCommandWithOutput(waitCmd) |
|
| 201 |
- errorOut(err, t, fmt.Sprintf("error thrown while waiting for container: %s", out))
|
|
| 201 |
+ if waitOut, _, err := runCommandWithOutput(waitCmd); err != nil {
|
|
| 202 |
+ t.Fatalf("error thrown while waiting for container: %s, %v", waitOut, err)
|
|
| 203 |
+ } |
|
| 202 | 204 |
|
| 203 | 205 |
logsCmd := exec.Command(dockerBinary, "logs", out) |
| 204 |
- containerLogs, _, err := runCommandWithOutput(logsCmd) |
|
| 205 |
- errorOut(err, t, fmt.Sprintf("error thrown while trying to get container logs: %s", err))
|
|
| 206 |
+ logsOut, _, err := runCommandWithOutput(logsCmd) |
|
| 207 |
+ if err != nil {
|
|
| 208 |
+ t.Fatalf("error thrown while trying to get container logs: %s, %v", logsOut, err)
|
|
| 209 |
+ } |
|
| 206 | 210 |
|
| 207 |
- containerLogs = stripTrailingCharacters(containerLogs) |
|
| 211 |
+ containerLogs := stripTrailingCharacters(logsOut) |
|
| 208 | 212 |
|
| 209 | 213 |
if containerLogs != "blahblah" {
|
| 210 | 214 |
t.Errorf("logs didn't print the container's logs %s", containerLogs)
|
| 211 | 215 |
} |
| 212 | 216 |
|
| 213 | 217 |
rmCmd := exec.Command(dockerBinary, "rm", out) |
| 214 |
- _, _, err = runCommandWithOutput(rmCmd) |
|
| 215 |
- errorOut(err, t, fmt.Sprintf("rm failed to remove container %s", err))
|
|
| 218 |
+ if out, _, err = runCommandWithOutput(rmCmd); err != nil {
|
|
| 219 |
+ t.Fatalf("rm failed to remove container: %s, %v", out, err)
|
|
| 220 |
+ } |
|
| 216 | 221 |
|
| 217 | 222 |
deleteAllContainers() |
| 218 | 223 |
|
| ... | ... |
@@ -230,16 +230,20 @@ func TestRunDetachedContainerIDPrinting(t *testing.T) {
|
| 230 | 230 |
out = stripTrailingCharacters(out) |
| 231 | 231 |
|
| 232 | 232 |
inspectCmd := exec.Command(dockerBinary, "inspect", out) |
| 233 |
- inspectOut, _, err := runCommandWithOutput(inspectCmd) |
|
| 234 |
- errorOut(err, t, fmt.Sprintf("out should've been a container id: %s %s", out, inspectOut))
|
|
| 233 |
+ if inspectOut, _, err := runCommandWithOutput(inspectCmd); err != nil {
|
|
| 234 |
+ t.Fatalf("out should've been a container id: %s %v", inspectOut, err)
|
|
| 235 |
+ } |
|
| 235 | 236 |
|
| 236 | 237 |
waitCmd := exec.Command(dockerBinary, "wait", out) |
| 237 |
- _, _, err = runCommandWithOutput(waitCmd) |
|
| 238 |
- errorOut(err, t, fmt.Sprintf("error thrown while waiting for container: %s", out))
|
|
| 238 |
+ if waitOut, _, err := runCommandWithOutput(waitCmd); err != nil {
|
|
| 239 |
+ t.Fatalf("error thrown while waiting for container: %s, %v", waitOut, err)
|
|
| 240 |
+ } |
|
| 239 | 241 |
|
| 240 | 242 |
rmCmd := exec.Command(dockerBinary, "rm", out) |
| 241 | 243 |
rmOut, _, err := runCommandWithOutput(rmCmd) |
| 242 |
- errorOut(err, t, "rm failed to remove container") |
|
| 244 |
+ if err != nil {
|
|
| 245 |
+ t.Fatalf("rm failed to remove container: %s, %v", rmOut, err)
|
|
| 246 |
+ } |
|
| 243 | 247 |
|
| 244 | 248 |
rmOut = stripTrailingCharacters(rmOut) |
| 245 | 249 |
if rmOut != out {
|
| ... | ... |
@@ -267,7 +271,9 @@ func TestRunWorkingDirectory(t *testing.T) {
|
| 267 | 267 |
|
| 268 | 268 |
runCmd = exec.Command(dockerBinary, "run", "--workdir", "/root", "busybox", "pwd") |
| 269 | 269 |
out, _, _, err = runCommandWithStdoutStderr(runCmd) |
| 270 |
- errorOut(err, t, out) |
|
| 270 |
+ if err != nil {
|
|
| 271 |
+ t.Fatal(out, err) |
|
| 272 |
+ } |
|
| 271 | 273 |
|
| 272 | 274 |
out = stripTrailingCharacters(out) |
| 273 | 275 |
|