From 0fecfeee6398e2db6b7b3fd257645a6ea9aab542 Mon Sep 17 00:00:00 2001 From: haircommander Date: Fri, 13 Jul 2018 17:45:55 -0400 Subject: Podman load/tag/save prepend localhost when no repository is present Instead of having docker.io/library as its repository. Test included. Signed-off-by: haircommander --- test/e2e/load_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/e2e/tag_test.go | 6 +++--- 2 files changed, 59 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index 3fe68ad8e..d39f75927 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -161,4 +161,60 @@ var _ = Describe("Podman load", func() { inspect.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) }) + + It("podman load localhost repo from scratch", func() { + outfile := filepath.Join(podmanTest.TempDir, "load_test.tar.gz") + setup := podmanTest.Podman([]string{"pull", fedoraMinimal}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.Podman([]string{"tag", "fedora-minimal", "hello:world"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.Podman([]string{"rmi", "hello:world"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + load := podmanTest.Podman([]string{"load", "-i", outfile}) + load.WaitWithDefaultTimeout() + Expect(load.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"images", "-f", "label", "hello:world"}) + result.WaitWithDefaultTimeout() + Expect(result.LineInOutputContains("docker")).To(Not(BeTrue())) + Expect(result.LineInOutputContains("localhost")).To(BeTrue()) + }) + + It("podman load localhost repo from dir", func() { + outfile := filepath.Join(podmanTest.TempDir, "load") + setup := podmanTest.Podman([]string{"pull", fedoraMinimal}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.Podman([]string{"tag", "fedora-minimal", "hello:world"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + setup = podmanTest.Podman([]string{"rmi", "hello:world"}) + setup.WaitWithDefaultTimeout() + Expect(setup.ExitCode()).To(Equal(0)) + + load := podmanTest.Podman([]string{"load", "-i", outfile}) + load.WaitWithDefaultTimeout() + Expect(load.ExitCode()).To(Equal(0)) + + result := podmanTest.Podman([]string{"images", "-f", "label", "load:latest"}) + result.WaitWithDefaultTimeout() + Expect(result.LineInOutputContains("docker")).To(Not(BeTrue())) + Expect(result.LineInOutputContains("localhost")).To(BeTrue()) + }) }) diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go index 5b578ee07..b07bc5550 100644 --- a/test/e2e/tag_test.go +++ b/test/e2e/tag_test.go @@ -38,7 +38,7 @@ var _ = Describe("Podman tag", func() { Expect(results.ExitCode()).To(Equal(0)) inspectData := results.InspectImageJSON() Expect(StringInSlice("docker.io/library/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) - Expect(StringInSlice("foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) + Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) }) It("podman tag shortname", func() { @@ -51,7 +51,7 @@ var _ = Describe("Podman tag", func() { Expect(results.ExitCode()).To(Equal(0)) inspectData := results.InspectImageJSON() Expect(StringInSlice("docker.io/library/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) - Expect(StringInSlice("foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) + Expect(StringInSlice("localhost/foobar:latest", inspectData[0].RepoTags)).To(BeTrue()) }) It("podman tag shortname:tag", func() { @@ -64,7 +64,7 @@ var _ = Describe("Podman tag", func() { Expect(results.ExitCode()).To(Equal(0)) inspectData := results.InspectImageJSON() Expect(StringInSlice("docker.io/library/alpine:latest", inspectData[0].RepoTags)).To(BeTrue()) - Expect(StringInSlice("foobar:new", inspectData[0].RepoTags)).To(BeTrue()) + Expect(StringInSlice("localhost/foobar:new", inspectData[0].RepoTags)).To(BeTrue()) }) It("podman tag shortname image no tag", func() { -- cgit v1.2.3-54-g00ecf