Rewrite TestBuildHistory to not use fixtures

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: ab4738b49fa72b5ac1d5cc441f6e5bb4328a04c6
Component: engine
This commit is contained in:
Alexandr Morozov
2014-09-24 12:38:48 +04:00
parent 49a6b8858b
commit a1e93ec56c
2 changed files with 33 additions and 39 deletions

View File

@ -1,28 +0,0 @@
FROM busybox
RUN echo "A"
RUN echo "B"
RUN echo "C"
RUN echo "D"
RUN echo "E"
RUN echo "F"
RUN echo "G"
RUN echo "H"
RUN echo "I"
RUN echo "J"
RUN echo "K"
RUN echo "L"
RUN echo "M"
RUN echo "N"
RUN echo "O"
RUN echo "P"
RUN echo "Q"
RUN echo "R"
RUN echo "S"
RUN echo "T"
RUN echo "U"
RUN echo "V"
RUN echo "W"
RUN echo "X"
RUN echo "Y"
RUN echo "Z"

View File

@ -3,7 +3,6 @@ package main
import (
"fmt"
"os/exec"
"path/filepath"
"strings"
"testing"
)
@ -11,17 +10,42 @@ import (
// This is a heisen-test. Because the created timestamp of images and the behavior of
// sort is not predictable it doesn't always fail.
func TestBuildHistory(t *testing.T) {
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestBuildHistory")
buildCmd := exec.Command(dockerBinary, "build", "-t", "testbuildhistory", ".")
name := "testbuildhistory"
defer deleteImages(name)
_, err := buildImage(name, `FROM busybox
RUN echo "A"
RUN echo "B"
RUN echo "C"
RUN echo "D"
RUN echo "E"
RUN echo "F"
RUN echo "G"
RUN echo "H"
RUN echo "I"
RUN echo "J"
RUN echo "K"
RUN echo "L"
RUN echo "M"
RUN echo "N"
RUN echo "O"
RUN echo "P"
RUN echo "Q"
RUN echo "R"
RUN echo "S"
RUN echo "T"
RUN echo "U"
RUN echo "V"
RUN echo "W"
RUN echo "X"
RUN echo "Y"
RUN echo "Z"`,
true)
buildCmd.Dir = buildDirectory
out, exitCode, err := runCommandWithOutput(buildCmd)
errorOut(err, t, fmt.Sprintf("build failed to complete: %v %v", out, err))
if err != nil || exitCode != 0 {
t.Fatal("failed to build the image")
if err != nil {
t.Fatal(err)
}
out, exitCode, err = runCommandWithOutput(exec.Command(dockerBinary, "history", "testbuildhistory"))
out, exitCode, err := runCommandWithOutput(exec.Command(dockerBinary, "history", "testbuildhistory"))
errorOut(err, t, fmt.Sprintf("image history failed: %v %v", out, err))
if err != nil || exitCode != 0 {
t.Fatal("failed to get image history")
@ -39,8 +63,6 @@ func TestBuildHistory(t *testing.T) {
}
}
deleteImages("testbuildhistory")
logDone("history - build history")
}