From 5ab35b8993b32f1c3f30aaa5056008ec47d88dcb Mon Sep 17 00:00:00 2001 From: Alexandr Morozov Date: Tue, 14 Oct 2014 10:26:20 -0700 Subject: [PATCH] Rewrite TestBuildCopyDirContentToExistDir to not use fixtures Signed-off-by: Alexandr Morozov Upstream-commit: 4a029259ff41c37eb72a6f221f9725f66491139f Component: engine --- .../TestCopy/DirContentToExistDir/Dockerfile | 10 ------- .../DirContentToExistDir/test_dir/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/DirContentToExistDir/Dockerfile delete mode 100644 components/engine/integration-cli/build_tests/TestCopy/DirContentToExistDir/test_dir/test_file diff --git a/components/engine/integration-cli/build_tests/TestCopy/DirContentToExistDir/Dockerfile b/components/engine/integration-cli/build_tests/TestCopy/DirContentToExistDir/Dockerfile deleted file mode 100644 index d63e8538bb..0000000000 --- a/components/engine/integration-cli/build_tests/TestCopy/DirContentToExistDir/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_dir/ /exists/ -RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] -RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ] -RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ] diff --git a/components/engine/integration-cli/build_tests/TestCopy/DirContentToExistDir/test_dir/test_file b/components/engine/integration-cli/build_tests/TestCopy/DirContentToExistDir/test_dir/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 6293cb8a1a..146ab15ae7 100644 --- a/components/engine/integration-cli/docker_cli_build_test.go +++ b/components/engine/integration-cli/docker_cli_build_test.go @@ -759,13 +759,27 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, } func TestBuildCopyDirContentToExistDir(t *testing.T) { - buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy") - if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "DirContentToExistDir"); err != nil { - t.Fatalf("build failed to complete: %s, %v", out, err) + name := "testcopydircontenttoexistdir" + 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_dir/ /exists/ +RUN [ $(ls -l / | grep exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] +RUN [ $(ls -l /exists/exists_file | awk '{print $3":"$4}') = 'dockerio:dockerio' ] +RUN [ $(ls -l /exists/test_file | awk '{print $3":"$4}') = 'root:root' ]`, + map[string]string{ + "test_dir/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 directory contents to existing dir") }