|
@@ -167,3 +167,27 @@ func TestSaveAndLoadRepoFlags(t *testing.T) {
|
|
|
logDone("save - save a repo using -o")
|
|
|
logDone("load - load a repo using -i")
|
|
|
}
|
|
|
+
|
|
|
+func TestSaveMultipleNames(t *testing.T) {
|
|
|
+ repoName := "foobar-save-multi-name-test"
|
|
|
+
|
|
|
+ // Make one image
|
|
|
+ tagCmdFinal := fmt.Sprintf("%v tag scratch:latest %v-one:latest", dockerBinary, repoName)
|
|
|
+ tagCmd := exec.Command("bash", "-c", tagCmdFinal)
|
|
|
+ out, _, err := runCommandWithOutput(tagCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("failed to tag repo: %v %v", out, err))
|
|
|
+ // Make two images
|
|
|
+ tagCmdFinal = fmt.Sprintf("%v tag scratch:latest %v-two:latest", dockerBinary, repoName)
|
|
|
+ tagCmd = exec.Command("bash", "-c", tagCmdFinal)
|
|
|
+ out, _, err = runCommandWithOutput(tagCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("failed to tag repo: %v %v", out, err))
|
|
|
+
|
|
|
+ saveCmdFinal := fmt.Sprintf("%v save %v-one %v-two:latest | tar xO repositories | grep -q -E '(-one|-two)'", dockerBinary, repoName, repoName)
|
|
|
+ saveCmd := exec.Command("bash", "-c", saveCmdFinal)
|
|
|
+ out, _, err = runCommandWithOutput(saveCmd)
|
|
|
+ errorOut(err, t, fmt.Sprintf("failed to save multiple repos: %v %v", out, err))
|
|
|
+
|
|
|
+ deleteImages(repoName)
|
|
|
+
|
|
|
+ logDone("save - save by multiple names")
|
|
|
+}
|