save and load should support multi-tag for docker-archive

The docker-archive tar files can have multiple tags for the same
image stored in it. Load pulls all the tags found in the archive
when loading a tar file. Save can oush multiple tags of the same
image to a tar archive.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #819
Approved by: rhatdan
This commit is contained in:
umohnani8
2018-05-21 13:53:19 -04:00
committed by Atomic Bot
parent 0a4ade1c17
commit c8b72e57a7
14 changed files with 1782 additions and 1644 deletions

View File

@ -567,8 +567,8 @@ func (p *PodmanTest) GetHostDistribution() string {
return ""
}
for _, line := range content {
if strings.HasPrefix(fmt.Sprintf("%s", line), "ID") {
fields := strings.Split(fmt.Sprintf("%s", line), "=")
if strings.HasPrefix(fmt.Sprintf("%x", line), "ID") {
fields := strings.Split(fmt.Sprintf("%x", line), "=")
if len(fields) < 2 {
return ""
}

View File

@ -133,4 +133,32 @@ var _ = Describe("Podman load", func() {
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).ToNot(Equal(0))
})
It("podman load multiple tags", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
alpVersion := "docker.io/library/alpine:3.2"
pull := podmanTest.Podman([]string{"pull", alpVersion})
pull.WaitWithDefaultTimeout()
Expect(pull.ExitCode()).To(Equal(0))
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE, alpVersion})
save.WaitWithDefaultTimeout()
Expect(save.ExitCode()).To(Equal(0))
rmi := podmanTest.Podman([]string{"rmi", ALPINE, alpVersion})
rmi.WaitWithDefaultTimeout()
Expect(rmi.ExitCode()).To(Equal(0))
result := podmanTest.Podman([]string{"load", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
inspect := podmanTest.Podman([]string{"inspect", ALPINE})
inspect.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
inspect = podmanTest.Podman([]string{"inspect", alpVersion})
inspect.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
})