зеркало из https://github.com/microsoft/docker.git
integration-cli: add more tests for BuildAddTar
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
This commit is contained in:
Родитель
6dd8eb9520
Коммит
30519330c7
|
@ -1,3 +0,0 @@
|
|||
FROM busybox
|
||||
ADD test.tar /test.tar
|
||||
RUN cat /test.tar/test/foo
|
|
@ -1,3 +0,0 @@
|
|||
FROM busybox
|
||||
ADD test.tar /
|
||||
RUN cat /test/foo
|
Двоичные данные
integration-cli/build_tests/TestBuildAddTar/2/test.tar
Двоичные данные
integration-cli/build_tests/TestBuildAddTar/2/test.tar
Двоичный файл не отображается.
|
@ -0,0 +1,14 @@
|
|||
FROM busybox
|
||||
ADD test.tar /
|
||||
RUN cat /test/foo | grep Hi
|
||||
ADD test.tar /test.tar
|
||||
RUN cat /test.tar/test/foo | grep Hi
|
||||
ADD test.tar /unlikely-to-exist
|
||||
RUN cat /unlikely-to-exist/test/foo | grep Hi
|
||||
ADD test.tar /unlikely-to-exist-trailing-slash/
|
||||
RUN cat /unlikely-to-exist-trailing-slash/test/foo | grep Hi
|
||||
RUN mkdir /existing-directory
|
||||
ADD test.tar /existing-directory
|
||||
RUN cat /existing-directory/test/foo | grep Hi
|
||||
ADD test.tar /existing-directory-trailing-slash/
|
||||
RUN cat /existing-directory-trailing-slash/test/foo | grep Hi
|
|
@ -1747,33 +1747,12 @@ RUN [ "$(cat /testfile)" = 'test!' ]`
|
|||
func TestBuildAddTar(t *testing.T) {
|
||||
name := "testbuildaddtar"
|
||||
defer deleteImages(name)
|
||||
checkOutput := func(out string) {
|
||||
n := -1
|
||||
x := ""
|
||||
for i, line := range strings.Split(out, "\n") {
|
||||
if strings.HasPrefix(line, "Step 2") {
|
||||
n = i + 2
|
||||
x = line[strings.Index(line, "cat ")+4:]
|
||||
}
|
||||
if i == n {
|
||||
if line != "Hi" {
|
||||
t.Fatalf("Could not find contents of %s (expected 'Hi' got '%s'", x, line)
|
||||
}
|
||||
n = -2
|
||||
}
|
||||
}
|
||||
if n > -2 {
|
||||
t.Fatalf("Could not find contents of %s in build output", x)
|
||||
}
|
||||
}
|
||||
|
||||
for _, n := range []string{"1", "2"} {
|
||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestBuildAddTar", n)
|
||||
buildCmd := exec.Command(dockerBinary, "build", "-t", name, ".")
|
||||
buildCmd.Dir = buildDirectory
|
||||
out, _, err := runCommandWithOutput(buildCmd)
|
||||
errorOut(err, t, fmt.Sprintf("build failed to complete for TestBuildAddTar/%s: %v", n, err))
|
||||
checkOutput(out)
|
||||
}
|
||||
buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestBuildAddTar")
|
||||
buildCmd := exec.Command(dockerBinary, "build", "-t", name, ".")
|
||||
buildCmd.Dir = buildDirectory
|
||||
out, _, err := runCommandWithOutput(buildCmd)
|
||||
errorOut(err, t, fmt.Sprintf("build failed to complete for TestBuildAddTar/%s: %v", n, err))
|
||||
|
||||
logDone("build - ADD tar")
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче