mirror of https://github.com/docker/docs.git
Rewrite TestBuildHistory to not use fixtures
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
parent
1625cbfc4c
commit
ab4738b49f
|
@ -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"
|
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -11,17 +10,42 @@ import (
|
||||||
// This is a heisen-test. Because the created timestamp of images and the behavior of
|
// This is a heisen-test. Because the created timestamp of images and the behavior of
|
||||||
// sort is not predictable it doesn't always fail.
|
// sort is not predictable it doesn't always fail.
|
||||||
func TestBuildHistory(t *testing.T) {
|
func TestBuildHistory(t *testing.T) {
|
||||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestBuildHistory")
|
name := "testbuildhistory"
|
||||||
buildCmd := exec.Command(dockerBinary, "build", "-t", "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
|
if err != nil {
|
||||||
out, exitCode, err := runCommandWithOutput(buildCmd)
|
t.Fatal(err)
|
||||||
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")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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))
|
errorOut(err, t, fmt.Sprintf("image history failed: %v %v", out, err))
|
||||||
if err != nil || exitCode != 0 {
|
if err != nil || exitCode != 0 {
|
||||||
t.Fatal("failed to get image history")
|
t.Fatal("failed to get image history")
|
||||||
|
@ -39,8 +63,6 @@ func TestBuildHistory(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteImages("testbuildhistory")
|
|
||||||
|
|
||||||
logDone("history - build history")
|
logDone("history - build history")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue