mirror of
https://github.com/containers/podman.git
synced 2025-10-16 10:43:52 +08:00
e2e: ExitCleanly(): a few more
Commit 1 of 2: automated string replace Exit(0) -> ExitCleanly() Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -10,7 +10,6 @@ import (
|
||||
. "github.com/containers/podman/v4/test/utils"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
. "github.com/onsi/gomega/gexec"
|
||||
)
|
||||
|
||||
var _ = Describe("Podman save", func() {
|
||||
@ -20,7 +19,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save signature-policy flag", func() {
|
||||
@ -29,7 +28,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "--signature-policy", "/etc/containers/policy.json", "-o", outfile, ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save oci flag", func() {
|
||||
@ -37,7 +36,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save with stdout", func() {
|
||||
@ -46,7 +45,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", ALPINE, ">", outfile})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save quiet flag", func() {
|
||||
@ -54,7 +53,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "-q", "-o", outfile, ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save bogus image", func() {
|
||||
@ -70,7 +69,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
|
||||
// Smoke test if it looks like an OCI dir
|
||||
Expect(filepath.Join(outdir, "oci-layout")).Should(BeAnExistingFile())
|
||||
@ -83,7 +82,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "--format", "docker-dir", "-o", outdir, ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
|
||||
// Smoke test if it looks like a docker dir
|
||||
Expect(filepath.Join(outdir, "version")).Should(BeAnExistingFile())
|
||||
@ -94,7 +93,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-dir", "-o", outdir, ALPINE})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save to directory with --compress but not use docker-dir and oci-dir", func() {
|
||||
@ -140,7 +139,7 @@ var _ = Describe("Podman save", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", strings.Join([]string{strconv.Itoa(port), strconv.Itoa(port)}, ":"), REGISTRY_IMAGE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
if !WaitContainerReady(podmanTest, "registry", "listening on", 20, 1) {
|
||||
Skip("Cannot start docker registry.")
|
||||
}
|
||||
@ -176,15 +175,15 @@ default-docker:
|
||||
|
||||
session = podmanTest.Podman([]string{"tag", ALPINE, "localhost:5000/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"push", "--tls-verify=false", "--sign-by", "foo@bar.com", "localhost:5000/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"rmi", ALPINE, "localhost:5000/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
if !IsRemote() {
|
||||
// Generate a signature verification policy file
|
||||
@ -193,7 +192,7 @@ default-docker:
|
||||
|
||||
session = podmanTest.Podman([]string{"pull", "--tls-verify=false", "--signature-policy", policyPath, "localhost:5000/alpine"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
|
||||
save := podmanTest.Podman([]string{"save", "remove-signatures=true", "-o", outfile, "localhost:5000/alpine"})
|
||||
@ -206,13 +205,13 @@ default-docker:
|
||||
// pull a digest reference
|
||||
session := podmanTest.Podman([]string{"pull", ALPINELISTDIGEST})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
// save a digest reference should exit without error.
|
||||
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
|
||||
save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINELISTDIGEST})
|
||||
save.WaitWithDefaultTimeout()
|
||||
Expect(save).Should(Exit(0))
|
||||
Expect(save).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman save --multi-image-archive (tagged images)", func() {
|
||||
@ -224,7 +223,7 @@ default-docker:
|
||||
// most three images and sort them by size.
|
||||
session := podmanTest.Podman([]string{"images", "--sort", "size", "--format", "{{.ID}}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
ids := session.OutputToStringArray()
|
||||
|
||||
Expect(len(ids)).To(BeNumerically(">", 1), "We need to have *some* images to save")
|
||||
@ -242,17 +241,17 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) {
|
||||
outfile := filepath.Join(podmanTest.TempDir, "temp.tar")
|
||||
session := podmanTest.Podman(append([]string{"save", "-o", outfile, "--multi-image-archive"}, images...))
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
// Remove all images.
|
||||
session = podmanTest.Podman([]string{"rmi", "-af"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
// Now load the archive.
|
||||
session = podmanTest.Podman([]string{"load", "-i", outfile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
// Grep for each image in the `podman load` output.
|
||||
for _, image := range images {
|
||||
Expect(session.OutputToString()).To(ContainSubstring(image))
|
||||
@ -262,6 +261,6 @@ func multiImageSave(podmanTest *PodmanTestIntegration, images []string) {
|
||||
for _, image := range images {
|
||||
session = podmanTest.Podman([]string{"image", "exists", image})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user