Skip to content

Commit

Permalink
e2e: ExitCleanly(): manual fixes to get tests passing
Browse files Browse the repository at this point in the history
Commit 2 of 2: steps to make tests work under ExitCleanly()

Mostly adding "-q" to push/pull, but also:

 - revert ExitCleanly(), and add error-message checks
   if absent;

 - fix a test that was completely nonfunctional from
   Day One: test was getting skipped because registry
   couldn't start, because of missing ":z"s in mount option.
   Fixed, and removed the bypass;

 - use built-in skopeo, not pulled-container skopeo. Skopeo
   is already a requirement for system tests.

Signed-off-by: Ed Santiago <[email protected]>
  • Loading branch information
edsantiago committed Sep 22, 2023
1 parent 8e743fa commit 4916f7d
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 150 deletions.
56 changes: 33 additions & 23 deletions test/e2e/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ var _ = Describe("Podman load", func() {
images.WaitWithDefaultTimeout()
GinkgoWriter.Println(images.OutputToStringArray())

save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
})

It("podman load compressed tar file", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")

save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

Expand All @@ -51,39 +51,39 @@ var _ = Describe("Podman load", func() {
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
})

It("podman load oci-archive image", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")

save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
})

It("podman load oci-archive with signature", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")

save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-q", "--signature-policy", "/etc/containers/policy.json", "-i", outfile})
result.WaitWithDefaultTimeout()
if IsRemote() {
Expect(result).To(ExitWithError())
Expand All @@ -99,7 +99,7 @@ var _ = Describe("Podman load", func() {
It("podman load with quiet flag", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")

save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

Expand All @@ -116,15 +116,15 @@ var _ = Describe("Podman load", func() {
SkipIfRemote("Remote does not support loading directories")
outdir := filepath.Join(podmanTest.TempDir, "alpine")

save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "--format", "oci-dir", "-o", outdir, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "-i", outdir})
result := podmanTest.Podman([]string{"load", "-q", "-i", outdir})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
})
Expand Down Expand Up @@ -157,19 +157,19 @@ var _ = Describe("Podman load", func() {
outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
alpVersion := "quay.io/libpod/alpine:3.2"

pull := podmanTest.Podman([]string{"pull", alpVersion})
pull := podmanTest.Podman([]string{"pull", "-q", alpVersion})
pull.WaitWithDefaultTimeout()
Expect(pull).Should(ExitCleanly())

save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE, alpVersion})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE, alpVersion})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())

rmi := podmanTest.Podman([]string{"rmi", ALPINE, alpVersion})
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "-i", outfile})
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())

Expand All @@ -187,15 +187,15 @@ var _ = Describe("Podman load", func() {
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello:world"})
setup = podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

setup = podmanTest.Podman([]string{"rmi", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

load := podmanTest.Podman([]string{"load", "-i", outfile})
load := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
load.WaitWithDefaultTimeout()
Expect(load).Should(ExitCleanly())

Expand All @@ -212,15 +212,15 @@ var _ = Describe("Podman load", func() {
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", "hello"})
setup = podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-archive", "hello"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

setup = podmanTest.Podman([]string{"rmi", "hello"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

load := podmanTest.Podman([]string{"load", "-i", outfile})
load := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
load.WaitWithDefaultTimeout()
Expect(load).Should(ExitCleanly())

Expand All @@ -238,15 +238,15 @@ var _ = Describe("Podman load", func() {
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

setup = podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-dir", "hello:world"})
setup = podmanTest.Podman([]string{"save", "-q", "-o", outfile, "--format", "oci-dir", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

setup = podmanTest.Podman([]string{"rmi", "hello:world"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(ExitCleanly())

load := podmanTest.Podman([]string{"load", "-i", outfile})
load := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
load.WaitWithDefaultTimeout()
Expect(load).Should(ExitCleanly())
Expect(load.OutputToString()).To(ContainSubstring("Loaded image: sha256:"))
Expand All @@ -255,7 +255,7 @@ var _ = Describe("Podman load", func() {
It("podman load xz compressed image", func() {
outfile := filepath.Join(podmanTest.TempDir, "alp.tar")

save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
save.WaitWithDefaultTimeout()
Expect(save).Should(ExitCleanly())
session := SystemExec("xz", []string{outfile})
Expand All @@ -265,16 +265,26 @@ var _ = Describe("Podman load", func() {
rmi.WaitWithDefaultTimeout()
Expect(rmi).Should(ExitCleanly())

result := podmanTest.Podman([]string{"load", "-i", outfile + ".xz"})
result := podmanTest.Podman([]string{"load", "-q", "-i", outfile + ".xz"})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
})

It("podman load multi-image archive", func() {
result := podmanTest.Podman([]string{"load", "-i", "./testdata/docker-two-images.tar.xz"})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("example.com/empty:latest"))
Expect(result.OutputToString()).To(ContainSubstring("example.com/empty/but:different"))

stderr := result.ErrorToString()
if IsRemote() {
Expect(stderr).To(BeEmpty(), "no stderr when running remote")
} else {
Expect(stderr).To(ContainSubstring("Getting image source signatures"))
Expect(stderr).To(ContainSubstring("Copying blob"))
Expect(stderr).To(ContainSubstring("Writing manifest to image destination"))
Expect(stderr).To(ContainSubstring("Copying config sha256:"))
}
})
})
Loading

0 comments on commit 4916f7d

Please sign in to comment.