Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
| ... | ... |
@@ -2,7 +2,6 @@ package main |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 |
- "fmt" |
|
| 6 | 5 |
"os/exec" |
| 7 | 6 |
"testing" |
| 8 | 7 |
) |
| ... | ... |
@@ -10,7 +9,9 @@ import ( |
| 10 | 10 |
func TestInspectApiContainerResponse(t *testing.T) {
|
| 11 | 11 |
runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true") |
| 12 | 12 |
out, _, err := runCommandWithOutput(runCmd) |
| 13 |
- errorOut(err, t, fmt.Sprintf("failed to create a container: %v %v", out, err))
|
|
| 13 |
+ if err != nil {
|
|
| 14 |
+ t.Fatalf("failed to create a container: %s, %v", out, err)
|
|
| 15 |
+ } |
|
| 14 | 16 |
|
| 15 | 17 |
cleanedContainerID := stripTrailingCharacters(out) |
| 16 | 18 |
|
| ... | ... |
@@ -10,13 +10,14 @@ func TestInspectImage(t *testing.T) {
|
| 10 | 10 |
imageTest := "scratch" |
| 11 | 11 |
imageTestID := "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158" |
| 12 | 12 |
imagesCmd := exec.Command(dockerBinary, "inspect", "--format='{{.Id}}'", imageTest)
|
| 13 |
- |
|
| 14 | 13 |
out, exitCode, err := runCommandWithOutput(imagesCmd) |
| 15 | 14 |
if exitCode != 0 || err != nil {
|
| 16 |
- t.Fatalf("failed to inspect image")
|
|
| 15 |
+ t.Fatalf("failed to inspect image: %s, %v", out, err)
|
|
| 17 | 16 |
} |
| 17 |
+ |
|
| 18 | 18 |
if id := strings.TrimSuffix(out, "\n"); id != imageTestID {
|
| 19 | 19 |
t.Fatalf("Expected id: %s for image: %s but received id: %s", imageTestID, imageTest, id)
|
| 20 | 20 |
} |
| 21 |
+ |
|
| 21 | 22 |
logDone("inspect - inspect an image")
|
| 22 | 23 |
} |