|
@@ -124,3 +124,36 @@ MAINTAINER foo`)
|
|
|
|
|
|
logDone("rmi - force delete with existing containers")
|
|
|
}
|
|
|
+
|
|
|
+func TestRmiWithMultipleRepositories(t *testing.T) {
|
|
|
+ defer deleteAllContainers()
|
|
|
+ newRepo := "127.0.0.1:5000/busybox"
|
|
|
+ oldRepo := "busybox"
|
|
|
+ newTag := "busybox:test"
|
|
|
+ cmd := exec.Command(dockerBinary, "tag", oldRepo, newRepo)
|
|
|
+ out, _, err := runCommandWithOutput(cmd)
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("Could not tag busybox: %v: %s", err, out)
|
|
|
+ }
|
|
|
+ cmd = exec.Command(dockerBinary, "run", "--name", "test", oldRepo, "touch", "/home/abcd")
|
|
|
+ out, _, err = runCommandWithOutput(cmd)
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("failed to run container: %v, output: %s", err, out)
|
|
|
+ }
|
|
|
+ cmd = exec.Command(dockerBinary, "commit", "test", newTag)
|
|
|
+ out, _, err = runCommandWithOutput(cmd)
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("failed to commit container: %v, output: %s", err, out)
|
|
|
+ }
|
|
|
+ cmd = exec.Command(dockerBinary, "rmi", newTag)
|
|
|
+ out, _, err = runCommandWithOutput(cmd)
|
|
|
+ if err != nil {
|
|
|
+ t.Fatalf("failed to remove image: %v, output: %s", err, out)
|
|
|
+ }
|
|
|
+ if !strings.Contains(out, "Untagged: "+newTag) {
|
|
|
+ t.Fatalf("Could not remove image %s: %s, %v", newTag, out, err)
|
|
|
+ }
|
|
|
+
|
|
|
+ logDone("rmi - delete a image which its dependency tagged to multiple repositories success")
|
|
|
+
|
|
|
+}
|