Files
podman/test/e2e/export_test.go
Ed Santiago 611db19b31 e2e: ExitCleanly(): the final fron^Wcommit
Final push on RUN-1907. Commit 1 of 2.

This is the final set of test/e2e/*_test.go files to be
converted from Exit(0) to ExitCleanly().

This commit is a mix of automated string-replace with
manual revert-back: tests that did not pass with ExitCleanly()
are reverted back to Exit(0), so they will not show up as
diffs in this commit. When possible, I address those in
my next commit.

My goal was to make this commit a don't-bother-reviewing one
that will also pass tests (so as not to break git-bisect).
The next commit is the important one to review.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2023-09-27 16:04:59 -06:00

54 lines
1.4 KiB
Go

package integration
import (
"os"
"path/filepath"
. "github.com/containers/podman/v4/test/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Podman export", func() {
It("podman export output flag", func() {
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
outfile := filepath.Join(podmanTest.TempDir, "container.tar")
result := podmanTest.Podman([]string{"export", "-o", outfile, cid})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
_, err := os.Stat(outfile)
Expect(err).ToNot(HaveOccurred())
err = os.Remove(outfile)
Expect(err).ToNot(HaveOccurred())
})
It("podman container export output flag", func() {
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
outfile := filepath.Join(podmanTest.TempDir, "container.tar")
result := podmanTest.Podman([]string{"container", "export", "-o", outfile, cid})
result.WaitWithDefaultTimeout()
Expect(result).Should(ExitCleanly())
_, err := os.Stat(outfile)
Expect(err).ToNot(HaveOccurred())
err = os.Remove(outfile)
Expect(err).ToNot(HaveOccurred())
})
It("podman export bad filename", func() {
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
outfile := filepath.Join(podmanTest.TempDir, "container:with:colon.tar")
result := podmanTest.Podman([]string{"export", "-o", outfile, cid})
result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError())
})
})