Browse code

Rewrite TestBuildForceRm to not use fixtures

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

Alexandr Morozov authored on 2014/09/24 17:29:27
Showing 2 changed files
1 1
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-FROM busybox
2
-RUN true
3
-RUN thiswillfail
... ...
@@ -604,10 +604,16 @@ func TestBuildForceRm(t *testing.T) {
604 604
 	if err != nil {
605 605
 		t.Fatalf("failed to get the container count: %s", err)
606 606
 	}
607
+	name := "testbuildforcerm"
608
+	defer deleteImages(name)
609
+	ctx, err := fakeContext("FROM scratch\nRUN true\nRUN thiswillfail", nil)
610
+	if err != nil {
611
+		t.Fatal(err)
612
+	}
613
+	defer ctx.Close()
607 614
 
608
-	buildDirectory := filepath.Join(workingDirectory, "build_tests", "TestBuildForceRm")
609
-	buildCmd := exec.Command(dockerBinary, "build", "--force-rm", ".")
610
-	buildCmd.Dir = buildDirectory
615
+	buildCmd := exec.Command(dockerBinary, "build", "-t", name, "--force-rm", ".")
616
+	buildCmd.Dir = ctx.Dir
611 617
 	_, exitCode, err := runCommandWithOutput(buildCmd)
612 618
 
613 619
 	if err == nil || exitCode == 0 {