ソースを参照

Rewrite TestBuildCopyEtcToRoot to not use fixtures

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Alexandr Morozov 10 年 前
コミット
c8a5d56fd7

+ 0 - 2
integration-cli/build_tests/TestCopy/EtcToRoot/Dockerfile

@@ -1,2 +0,0 @@
-FROM scratch
-COPY . /

+ 12 - 5
integration-cli/docker_cli_build_test.go

@@ -810,12 +810,19 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
 }
 }
 
 
 func TestBuildCopyEtcToRoot(t *testing.T) {
 func TestBuildCopyEtcToRoot(t *testing.T) {
-	buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy")
-	if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "EtcToRoot"); err != nil {
-		t.Fatalf("build failed to complete: %s, %v", out, err)
+	name := "testcopyetctoroot"
+	defer deleteImages(name)
+	ctx, err := fakeContext(`FROM scratch
+COPY . /`,
+		map[string]string{
+			"etc/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 etc directory to root")
 	logDone("build - copy etc directory to root")
 }
 }