From ab4738b49fa72b5ac1d5cc441f6e5bb4328a04c6 Mon Sep 17 00:00:00 2001 From: Alexandr Morozov Date: Wed, 24 Sep 2014 12:38:48 +0400 Subject: [PATCH] Rewrite TestBuildHistory to not use fixtures Signed-off-by: Alexandr Morozov --- .../build_tests/TestBuildHistory/Dockerfile | 28 ------------ integration-cli/docker_cli_history_test.go | 44 ++++++++++++++----- 2 files changed, 33 insertions(+), 39 deletions(-) delete mode 100644 integration-cli/build_tests/TestBuildHistory/Dockerfile diff --git a/integration-cli/build_tests/TestBuildHistory/Dockerfile b/integration-cli/build_tests/TestBuildHistory/Dockerfile deleted file mode 100644 index 56c47105cc..0000000000 --- a/integration-cli/build_tests/TestBuildHistory/Dockerfile +++ /dev/null @@ -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" diff --git a/integration-cli/docker_cli_history_test.go b/integration-cli/docker_cli_history_test.go index c76c3a2fbf..18e882d205 100644 --- a/integration-cli/docker_cli_history_test.go +++ b/integration-cli/docker_cli_history_test.go @@ -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") }