From 2d802d7f23ad0d9f59abd8144f2bad094e338339 Mon Sep 17 00:00:00 2001 From: Alexandr Morozov Date: Mon, 22 Sep 2014 20:47:01 +0400 Subject: [PATCH] Rewrite TestBuildAddDirContentToRoot to not use fixtures Signed-off-by: Alexandr Morozov --- .../TestAdd/DirContentToRoot/Dockerfile | 8 ------ .../DirContentToRoot/test_dir/test_file | 0 integration-cli/docker_cli_build_test.go | 27 ++++++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 integration-cli/build_tests/TestAdd/DirContentToRoot/Dockerfile delete mode 100644 integration-cli/build_tests/TestAdd/DirContentToRoot/test_dir/test_file diff --git a/integration-cli/build_tests/TestAdd/DirContentToRoot/Dockerfile b/integration-cli/build_tests/TestAdd/DirContentToRoot/Dockerfile deleted file mode 100644 index 03a9c052fd..0000000000 --- a/integration-cli/build_tests/TestAdd/DirContentToRoot/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM busybox -RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd -RUN echo 'dockerio:x:1001:' >> /etc/group -RUN touch /exists -RUN chown dockerio.dockerio exists -ADD test_dir / -RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ] -RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ] diff --git a/integration-cli/build_tests/TestAdd/DirContentToRoot/test_dir/test_file b/integration-cli/build_tests/TestAdd/DirContentToRoot/test_dir/test_file deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 147d28ed7a..6e7a271435 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -221,16 +221,25 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, } func TestBuildAddDirContentToRoot(t *testing.T) { - buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestAdd") - out, exitCode, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testaddimg", "DirContentToRoot") - 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") + name := "testadddircontenttoroot" + 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 touch /exists +RUN chown dockerio.dockerio exists +ADD test_dir / +RUN [ $(ls -l /test_file | awk '{print $3":"$4}') = 'root:root' ] +RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`, + 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("testaddimg") - logDone("build - add directory contents to root") }