mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
improve test
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
parent
3e4e8636c1
commit
614c57c521
1 changed files with 10 additions and 2 deletions
|
@ -25,6 +25,10 @@ func TestSaveAndLoadRepo(t *testing.T) {
|
||||||
out, _, err = runCommandWithOutput(commitCmd)
|
out, _, err = runCommandWithOutput(commitCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("failed to commit container: %v %v", out, err))
|
errorOut(err, t, fmt.Sprintf("failed to commit container: %v %v", out, err))
|
||||||
|
|
||||||
|
inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
|
||||||
|
before, _, err := runCommandWithOutput(inspectCmd)
|
||||||
|
errorOut(err, t, fmt.Sprintf("the repo should exist before saving it: %v %v", before, err))
|
||||||
|
|
||||||
saveCmdTemplate := `%v save %v > /tmp/foobar-save-load-test.tar`
|
saveCmdTemplate := `%v save %v > /tmp/foobar-save-load-test.tar`
|
||||||
saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName)
|
saveCmdFinal := fmt.Sprintf(saveCmdTemplate, dockerBinary, repoName)
|
||||||
saveCmd := exec.Command("bash", "-c", saveCmdFinal)
|
saveCmd := exec.Command("bash", "-c", saveCmdFinal)
|
||||||
|
@ -39,8 +43,12 @@ func TestSaveAndLoadRepo(t *testing.T) {
|
||||||
errorOut(err, t, fmt.Sprintf("failed to load repo: %v %v", out, err))
|
errorOut(err, t, fmt.Sprintf("failed to load repo: %v %v", out, err))
|
||||||
|
|
||||||
inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
|
inspectCmd = exec.Command(dockerBinary, "inspect", repoName)
|
||||||
out, _, err = runCommandWithOutput(inspectCmd)
|
after, _, err := runCommandWithOutput(inspectCmd)
|
||||||
errorOut(err, t, fmt.Sprintf("the repo should exist after loading it: %v %v", out, err))
|
errorOut(err, t, fmt.Sprintf("the repo should exist after loading it: %v %v", after, err))
|
||||||
|
|
||||||
|
if before != after {
|
||||||
|
t.Fatalf("inspect is not the same after a save / load")
|
||||||
|
}
|
||||||
|
|
||||||
deleteContainer(cleanedContainerID)
|
deleteContainer(cleanedContainerID)
|
||||||
deleteImages(repoName)
|
deleteImages(repoName)
|
||||||
|
|
Loading…
Reference in a new issue