From f2d974c957df1ab1c8a0c5ed9a88ac81a70f0344 Mon Sep 17 00:00:00 2001 From: Alexandr Morozov Date: Tue, 14 Oct 2014 10:15:45 -0700 Subject: [PATCH] Rewrite TestBuildCopySingleFileToExistDir to not use fixtures Signed-off-by: Alexandr Morozov Upstream-commit: 2248109ff8607264ba40d4a4ac24bad66462d105 Component: engine --- .../TestCopy/SingleFileToExistDir/Dockerfile | 10 ------- .../TestCopy/SingleFileToExistDir/test_file | 0 .../integration-cli/docker_cli_build_test.go | 26 ++++++++++++++----- 3 files changed, 20 insertions(+), 16 deletions(-) delete mode 100644 components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/Dockerfile delete mode 100644 components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/test_file diff --git a/components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/Dockerfile b/components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/Dockerfile deleted file mode 100644 index 3edfe661d4..0000000000 --- a/components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM busybox -RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd -RUN echo 'dockerio:x:1001:' >> /etc/group -RUN mkdir /exists -RUN touch /exists/exists_file -RUN chown -R dockerio.dockerio /exists -COPY test_file /exists/ -RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] -RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ] -RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ] diff --git a/components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/test_file b/components/engine/integration-cli/build_tests/TestCopy/SingleFileToExistDir/test_file deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/engine/integration-cli/docker_cli_build_test.go b/components/engine/integration-cli/docker_cli_build_test.go index 511e2dda06..3026a38887 100644 --- a/components/engine/integration-cli/docker_cli_build_test.go +++ b/components/engine/integration-cli/docker_cli_build_test.go @@ -687,13 +687,27 @@ COPY test_file .`, } func TestBuildCopySingleFileToExistDir(t *testing.T) { - buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") - if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "SingleFileToExistDir"); err != nil { - t.Fatalf("build failed to complete: %s, %v", out, err) + name := "testcopysinglefiletoexistdir" + defer deleteImages(name) + ctx, err := fakeContext(`FROM busybox +RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd +RUN echo 'dockerio:x:1001:' >> /etc/group +RUN mkdir /exists +RUN touch /exists/exists_file +RUN chown -R dockerio.dockerio /exists +COPY test_file /exists/ +RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] +RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ] +RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, + map[string]string{ + "test_file": "test1", + }) + if err != nil { + t.Fatal(err) + } + if _, err := buildImageFromContext(name, ctx, true); err != nil { + t.Fatal(err) } - - deleteImages("testcopyimg") - logDone("build - copy single file to existing dir") }