Files
podman/test/e2e/export_test.go
Paul Holzinger 666d839157 golangci-lint: make windows linting happy
It qemu cannot be compiled anyway so make sure we do not try to compile
parts where the typechecker complains about on windows.
Also all the e2e test files are only used on linux as well.
pkg/machine/wsl also reports some error but to many for me to fix them
now. One minor problem was fixed in pkg/machine/machine_windows.go.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-08-19 11:41:29 +02:00

56 lines
1.5 KiB
Go

//go:build linux || freebsd
package integration
import (
"os"
"path/filepath"
. "github.com/containers/podman/v5/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(125, "invalid filename (should not contain ':')"))
})
})