Browse code

Rewrite TestBuildCopyEtcToRoot to not use fixtures

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>

Alexandr Morozov authored on 2014/10/15 02:32:00
Showing 2 changed files
1 1
deleted file mode 100644
... ...
@@ -1,2 +0,0 @@
1
-FROM scratch
2
-COPY . /
... ...
@@ -810,12 +810,19 @@ RUN [ $(ls -l /exists | awk '{print $3":"$4}') = 'dockerio:dockerio' ]`,
810 810
 }
811 811
 
812 812
 func TestBuildCopyEtcToRoot(t *testing.T) {
813
-	buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestCopy")
814
-	if out, _, err := dockerCmdInDir(t, buildDirectory, "build", "-t", "testcopyimg", "EtcToRoot"); err != nil {
815
-		t.Fatalf("build failed to complete: %s, %v", out, err)
813
+	name := "testcopyetctoroot"
814
+	defer deleteImages(name)
815
+	ctx, err := fakeContext(`FROM scratch
816
+COPY . /`,
817
+		map[string]string{
818
+			"etc/test_file": "test1",
819
+		})
820
+	if err != nil {
821
+		t.Fatal(err)
822
+	}
823
+	if _, err := buildImageFromContext(name, ctx, true); err != nil {
824
+		t.Fatal(err)
816 825
 	}
817
-
818
-	deleteImages("testcopyimg")
819 826
 	logDone("build - copy etc directory to root")
820 827
 }
821 828