diff options
Diffstat (limited to 'test/e2e')
44 files changed, 454 insertions, 121 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 68f733b41..80ee83f44 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -35,7 +35,7 @@ var ( INTEGRATION_ROOT string CGROUP_MANAGER = "systemd" ARTIFACT_DIR = "/tmp/.artifacts" - RESTORE_IMAGES = []string{ALPINE, BB} + RESTORE_IMAGES = []string{ALPINE, BB, nginx} defaultWaitTimeout = 90 ) @@ -53,6 +53,7 @@ type PodmanTestIntegration struct { Host HostOS Timings []string TmpDir string + RemoteStartErr error } var LockTmpDir string @@ -259,12 +260,12 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration { p.PodmanTest.RemotePodmanBinary = podmanRemoteBinary uuid := stringid.GenerateNonCryptoID() if !rootless.IsRootless() { - p.VarlinkEndpoint = fmt.Sprintf("unix:/run/podman/io.podman-%s", uuid) + p.RemoteSocket = fmt.Sprintf("unix:/run/podman/podman-%s.sock", uuid) } else { runtimeDir := os.Getenv("XDG_RUNTIME_DIR") - socket := fmt.Sprintf("io.podman-%s", uuid) + socket := fmt.Sprintf("podman-%s.sock", uuid) fqpath := filepath.Join(runtimeDir, socket) - p.VarlinkEndpoint = fmt.Sprintf("unix:%s", fqpath) + p.RemoteSocket = fmt.Sprintf("unix:%s", fqpath) } } @@ -441,7 +442,7 @@ func (p *PodmanTestIntegration) Cleanup() { session := p.Podman([]string{"rm", "-fa"}) session.Wait(90) - p.StopVarlink() + p.StopRemoteService() // Nuke tempdir if err := os.RemoveAll(p.TempDir); err != nil { fmt.Printf("%q\n", err) @@ -451,17 +452,6 @@ func (p *PodmanTestIntegration) Cleanup() { resetRegistriesConfigEnv() } -// CleanupPod cleans up the temporary store -func (p *PodmanTestIntegration) CleanupPod() { - // Remove all containers - session := p.Podman([]string{"pod", "rm", "-fa"}) - session.Wait(90) - // Nuke tempdir - if err := os.RemoveAll(p.TempDir); err != nil { - fmt.Printf("%q\n", err) - } -} - // CleanupVolume cleans up the temporary store func (p *PodmanTestIntegration) CleanupVolume() { // Remove all containers diff --git a/test/e2e/config.go b/test/e2e/config.go index 0e1850614..71c4dee31 100644 --- a/test/e2e/config.go +++ b/test/e2e/config.go @@ -27,4 +27,8 @@ var ( // v2fail is a temporary variable to help us track // tests that fail in v2 v2fail = "does not pass integration tests with v2 podman" + + // v2remotefail is a temporary variable to help us track + // tests that fail in v2 remote + v2remotefail = "does not pass integration tests with v2 podman remote" ) diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go index 91c025197..9cbcbbc7c 100644 --- a/test/e2e/container_inspect_test.go +++ b/test/e2e/container_inspect_test.go @@ -27,7 +27,7 @@ var _ = Describe("Podman container inspect", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) }) diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 1041b30bb..0a6373bfa 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -35,13 +35,13 @@ var _ = Describe("Podman create", func() { }) It("podman create container based on a local image", func() { - session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--name", "local_image_test", ALPINE, "ls"}) session.WaitWithDefaultTimeout() cid := session.OutputToString() Expect(session.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainers()).To(Equal(1)) - check := podmanTest.Podman([]string{"inspect", "-l"}) + check := podmanTest.Podman([]string{"inspect", "local_image_test"}) check.WaitWithDefaultTimeout() data := check.InspectContainerToJSON() Expect(data[0].ID).To(ContainSubstring(cid)) @@ -80,12 +80,12 @@ var _ = Describe("Podman create", func() { }) It("podman create adds annotation", func() { - session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD", ALPINE, "ls"}) + session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD", "--name", "annotate_test", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainers()).To(Equal(1)) - check := podmanTest.Podman([]string{"inspect", "-l"}) + check := podmanTest.Podman([]string{"inspect", "annotate_test"}) check.WaitWithDefaultTimeout() data := check.InspectContainerToJSON() value, ok := data[0].Config.Annotations["HELLO"] @@ -94,12 +94,12 @@ var _ = Describe("Podman create", func() { }) It("podman create --entrypoint command", func() { - session := podmanTest.Podman([]string{"create", "--entrypoint", "/bin/foobar", ALPINE}) + session := podmanTest.Podman([]string{"create", "--name", "entrypoint_test", "--entrypoint", "/bin/foobar", ALPINE}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainers()).To(Equal(1)) - result := podmanTest.Podman([]string{"inspect", "-l", "--format", "{{.Config.Entrypoint}}"}) + result := podmanTest.Podman([]string{"inspect", "entrypoint_test", "--format", "{{.Config.Entrypoint}}"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) Expect(result.OutputToString()).To(Equal("/bin/foobar")) @@ -119,18 +119,19 @@ var _ = Describe("Podman create", func() { It("podman create --entrypoint json", func() { jsonString := `[ "/bin/foo", "-c"]` - session := podmanTest.Podman([]string{"create", "--entrypoint", jsonString, ALPINE}) + session := podmanTest.Podman([]string{"create", "--name", "entrypoint_json", "--entrypoint", jsonString, ALPINE}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) Expect(podmanTest.NumberOfContainers()).To(Equal(1)) - result := podmanTest.Podman([]string{"inspect", "-l", "--format", "{{.Config.Entrypoint}}"}) + result := podmanTest.Podman([]string{"inspect", "entrypoint_json", "--format", "{{.Config.Entrypoint}}"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) Expect(result.OutputToString()).To(Equal("/bin/foo -c")) }) It("podman create --mount flag with multiple mounts", func() { + Skip(v2remotefail) vol1 := filepath.Join(podmanTest.TempDir, "vol-test1") err := os.MkdirAll(vol1, 0755) Expect(err).To(BeNil()) @@ -156,6 +157,7 @@ var _ = Describe("Podman create", func() { if podmanTest.Host.Arch == "ppc64le" { Skip("skip failing test on ppc64le") } + Skip(v2remotefail) mountPath := filepath.Join(podmanTest.TempDir, "secrets") os.Mkdir(mountPath, 0755) session := podmanTest.Podman([]string{"create", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"}) @@ -205,7 +207,7 @@ var _ = Describe("Podman create", func() { session = podmanTest.Podman([]string{"logs", "test_tmpfs"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("/create/test rw,nosuid,nodev,noexec,relatime - tmpfs")) + Expect(session.OutputToString()).To(ContainSubstring("/create/test rw,nosuid,nodev,relatime - tmpfs")) }) It("podman create --pod automatically", func() { @@ -233,11 +235,11 @@ var _ = Describe("Podman create", func() { }) It("podman create --pull", func() { - session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "nginx"}) + session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "debian"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) - session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "nginx"}) + session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "debian"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) }) diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index 4cd5de05e..460554b77 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -19,7 +19,6 @@ var _ = Describe("Podman events", func() { ) BeforeEach(func() { - SkipIfRootlessV2() tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) @@ -119,6 +118,7 @@ var _ = Describe("Podman events", func() { }) It("podman events format", func() { + Skip(v2remotefail) info := GetHostDistributionInfo() if info.Distribution != "fedora" { Skip("need to verify images have correct packages for journald") @@ -138,5 +138,19 @@ var _ = Describe("Podman events", func() { _, exist := eventsMap["Status"] Expect(exist).To(BeTrue()) Expect(test.ExitCode()).To(BeZero()) + + test = podmanTest.Podman([]string{"events", "--stream=false", "--format", "{{json.}}"}) + test.WaitWithDefaultTimeout() + fmt.Println(test.OutputToStringArray()) + jsonArr = test.OutputToStringArray() + Expect(len(jsonArr)).To(Not(BeZero())) + eventsMap = make(map[string]string) + err = json.Unmarshal([]byte(jsonArr[0]), &eventsMap) + if err != nil { + os.Exit(1) + } + _, exist = eventsMap["Status"] + Expect(exist).To(BeTrue()) + Expect(test.ExitCode()).To(BeZero()) }) }) diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index 8b95794d2..87dddb233 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -18,6 +18,7 @@ var _ = Describe("Podman exec", func() { ) BeforeEach(func() { + Skip(v2remotefail) tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) @@ -282,4 +283,31 @@ var _ = Describe("Podman exec", func() { Expect(exec.ExitCode()).To(Equal(0)) Expect(strings.Contains(exec.OutputToString(), fmt.Sprintf("%s(%s)", gid, groupName))).To(BeTrue()) }) + + It("podman exec --detach", func() { + ctrName := "testctr" + ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, ALPINE, "top"}) + ctr.WaitWithDefaultTimeout() + Expect(ctr.ExitCode()).To(Equal(0)) + + exec1 := podmanTest.Podman([]string{"exec", "-t", "-i", "-d", ctrName, "top"}) + exec1.WaitWithDefaultTimeout() + Expect(ctr.ExitCode()).To(Equal(0)) + + data := podmanTest.InspectContainer(ctrName) + Expect(len(data)).To(Equal(1)) + Expect(len(data[0].ExecIDs)).To(Equal(1)) + Expect(strings.Contains(exec1.OutputToString(), data[0].ExecIDs[0])).To(BeTrue()) + + exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "ps", "-a"}) + exec2.WaitWithDefaultTimeout() + Expect(ctr.ExitCode()).To(Equal(0)) + Expect(strings.Count(exec2.OutputToString(), "top")).To(Equal(2)) + + // Ensure that stop with a running detached exec session is + // clean. + stop := podmanTest.Podman([]string{"stop", ctrName}) + stop.WaitWithDefaultTimeout() + Expect(stop.ExitCode()).To(Equal(0)) + }) }) diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go index 1c84c6f4d..fb2582796 100644 --- a/test/e2e/export_test.go +++ b/test/e2e/export_test.go @@ -34,7 +34,6 @@ var _ = Describe("Podman export", func() { }) It("podman export output flag", func() { - SkipIfRemote() _, ec, cid := podmanTest.RunLsContainer("") Expect(ec).To(Equal(0)) @@ -50,7 +49,6 @@ var _ = Describe("Podman export", func() { }) It("podman container export output flag", func() { - SkipIfRemote() _, ec, cid := podmanTest.RunLsContainer("") Expect(ec).To(Equal(0)) diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index 19a8658ac..8e63d9f4c 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -176,6 +176,7 @@ var _ = Describe("Podman healthcheck run", func() { }) It("podman healthcheck single healthy result changes failed to healthy", func() { + Skip(v2remotefail) session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--health-retries", "2", "--health-cmd", "ls /foo || exit 1", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index d7295b67a..1b23aba36 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -90,7 +90,7 @@ var _ = Describe("Podman images", func() { session = podmanTest.PodmanNoCache([]string{"images", "-qn"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 2)) + Expect(len(session.OutputToStringArray())).To(BeNumerically("==", 3)) }) It("podman images with digests", func() { @@ -151,9 +151,7 @@ var _ = Describe("Podman images", func() { }) It("podman images filter reference", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } + SkipIfRemote() podmanTest.RestoreAllArtifacts() result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=docker.io*"}) result.WaitWithDefaultTimeout() @@ -163,13 +161,13 @@ var _ = Describe("Podman images", func() { retapline := podmanTest.PodmanNoCache([]string{"images", "-f", "reference=a*pine"}) retapline.WaitWithDefaultTimeout() Expect(retapline).Should(Exit(0)) - Expect(len(retapline.OutputToStringArray())).To(Equal(2)) + Expect(len(retapline.OutputToStringArray())).To(Equal(3)) Expect(retapline.LineInOutputContains("alpine")).To(BeTrue()) retapline = podmanTest.PodmanNoCache([]string{"images", "-f", "reference=alpine"}) retapline.WaitWithDefaultTimeout() Expect(retapline).Should(Exit(0)) - Expect(len(retapline.OutputToStringArray())).To(Equal(2)) + Expect(len(retapline.OutputToStringArray())).To(Equal(3)) Expect(retapline.LineInOutputContains("alpine")).To(BeTrue()) retnone := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=bogus"}) @@ -179,9 +177,7 @@ var _ = Describe("Podman images", func() { }) It("podman images filter before image", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } + SkipIfRemote() dockerfile := `FROM docker.io/library/alpine:latest RUN apk update && apk add man ` @@ -193,9 +189,7 @@ RUN apk update && apk add man }) It("podman images filter after image", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } + SkipIfRemote() podmanTest.RestoreAllArtifacts() rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"}) rmi.WaitWithDefaultTimeout() @@ -211,9 +205,7 @@ RUN apk update && apk add man }) It("podman image list filter after image", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } + SkipIfRemote() podmanTest.RestoreAllArtifacts() rmi := podmanTest.PodmanNoCache([]string{"image", "rm", "busybox"}) rmi.WaitWithDefaultTimeout() @@ -229,9 +221,7 @@ RUN apk update && apk add man }) It("podman images filter dangling", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } + SkipIfRemote() dockerfile := `FROM docker.io/library/alpine:latest ` podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false") @@ -307,9 +297,7 @@ RUN apk update && apk add man }) It("podman images --all flag", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } + SkipIfRemote() podmanTest.RestoreAllArtifacts() dockerfile := `FROM docker.io/library/alpine:latest RUN mkdir hello @@ -320,12 +308,12 @@ ENV foo=bar session := podmanTest.PodmanNoCache([]string{"images"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - Expect(len(session.OutputToStringArray())).To(Equal(4)) + Expect(len(session.OutputToStringArray())).To(Equal(5)) session2 := podmanTest.PodmanNoCache([]string{"images", "--all"}) session2.WaitWithDefaultTimeout() Expect(session2).Should(Exit(0)) - Expect(len(session2.OutputToStringArray())).To(Equal(6)) + Expect(len(session2.OutputToStringArray())).To(Equal(7)) }) It("podman images filter by label", func() { @@ -342,10 +330,7 @@ LABEL "com.example.vendor"="Example Vendor" }) It("podman with images with no layers", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } - + SkipIfRemote() dockerfile := strings.Join([]string{ `FROM scratch`, `LABEL org.opencontainers.image.authors="<somefolks@example.org>"`, diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index 7cb299e0f..dbdaa05a7 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -33,7 +33,6 @@ var _ = Describe("Podman Info", func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) - }) It("podman info json output", func() { diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go index 919fe4abf..721017d0c 100644 --- a/test/e2e/init_test.go +++ b/test/e2e/init_test.go @@ -75,6 +75,7 @@ var _ = Describe("Podman init", func() { }) It("podman init latest container", func() { + SkipIfRemote() session := podmanTest.Podman([]string{"create", "-d", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -119,10 +120,10 @@ var _ = Describe("Podman init", func() { }) It("podman init running container errors", func() { - session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top"}) + session := podmanTest.Podman([]string{"run", "--name", "init_test", "-d", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - init := podmanTest.Podman([]string{"init", "--latest"}) + init := podmanTest.Podman([]string{"init", "init_test"}) init.WaitWithDefaultTimeout() Expect(init.ExitCode()).To(Equal(125)) }) diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index ebac087ac..77cfe4fd3 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -43,7 +43,6 @@ var _ = Describe("Podman inspect", func() { }) It("podman inspect bogus container", func() { - SkipIfRemote() session := podmanTest.Podman([]string{"inspect", "foobar4321"}) session.WaitWithDefaultTimeout() Expect(session).To(ExitWithError()) @@ -67,7 +66,6 @@ var _ = Describe("Podman inspect", func() { }) It("podman inspect container with GO format for ConmonPidFile", func() { - SkipIfRemote() session, ec, _ := podmanTest.RunLsContainer("test1") Expect(ec).To(Equal(0)) @@ -77,11 +75,10 @@ var _ = Describe("Podman inspect", func() { }) It("podman inspect container with size", func() { - SkipIfRemote() - _, ec, _ := podmanTest.RunLsContainer("") + _, ec, _ := podmanTest.RunLsContainer("sizetest") Expect(ec).To(Equal(0)) - result := podmanTest.Podman([]string{"inspect", "--size", "-l"}) + result := podmanTest.Podman([]string{"inspect", "--size", "sizetest"}) result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(0)) conData := result.InspectContainerToJSON() @@ -90,7 +87,6 @@ var _ = Describe("Podman inspect", func() { }) It("podman inspect container and image", func() { - SkipIfRemote() ls, ec, _ := podmanTest.RunLsContainer("") Expect(ec).To(Equal(0)) cid := ls.OutputToString() @@ -102,7 +98,6 @@ var _ = Describe("Podman inspect", func() { }) It("podman inspect container and filter for Image{ID}", func() { - SkipIfRemote() ls, ec, _ := podmanTest.RunLsContainer("") Expect(ec).To(Equal(0)) cid := ls.OutputToString() @@ -119,7 +114,6 @@ var _ = Describe("Podman inspect", func() { }) It("podman inspect container and filter for CreateCommand", func() { - SkipIfRemote() ls, ec, _ := podmanTest.RunLsContainer("") Expect(ec).To(Equal(0)) cid := ls.OutputToString() diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go index 834f86b77..3f192fb55 100644 --- a/test/e2e/kill_test.go +++ b/test/e2e/kill_test.go @@ -100,6 +100,7 @@ var _ = Describe("Podman kill", func() { }) It("podman kill latest container", func() { + SkipIfRemote() session := podmanTest.RunTopContainer("") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go new file mode 100644 index 000000000..79d18115c --- /dev/null +++ b/test/e2e/libpod_suite_remote_test.go @@ -0,0 +1,214 @@ +// +build remoteclient + +package integration + +import ( + "bytes" + "errors" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" + "syscall" + "time" + + "github.com/containers/libpod/pkg/rootless" + "github.com/onsi/ginkgo" +) + +func SkipIfRemote() { + ginkgo.Skip("This function is not enabled for remote podman") +} + +func SkipIfRootless() { + if os.Geteuid() != 0 { + ginkgo.Skip("This function is not enabled for rootless podman") + } +} +func SkipIfRootlessV2() { + if os.Geteuid() != 0 { + ginkgo.Skip("This function is not enabled for v2 rootless podman") + } +} + +// Podman is the exec call to podman on the filesystem +func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration { + var remoteArgs = []string{"--remote", p.RemoteSocket} + remoteArgs = append(remoteArgs, args...) + podmanSession := p.PodmanBase(remoteArgs, false, false) + return &PodmanSessionIntegration{podmanSession} +} + +// PodmanExtraFiles is the exec call to podman on the filesystem and passes down extra files +func (p *PodmanTestIntegration) PodmanExtraFiles(args []string, extraFiles []*os.File) *PodmanSessionIntegration { + var remoteArgs = []string{"--remote", p.RemoteSocket} + remoteArgs = append(remoteArgs, args...) + podmanSession := p.PodmanAsUserBase(remoteArgs, 0, 0, "", nil, false, false, extraFiles) + return &PodmanSessionIntegration{podmanSession} +} + +// PodmanNoCache calls podman with out adding the imagecache +func (p *PodmanTestIntegration) PodmanNoCache(args []string) *PodmanSessionIntegration { + var remoteArgs = []string{"--remote", p.RemoteSocket} + remoteArgs = append(remoteArgs, args...) + podmanSession := p.PodmanBase(remoteArgs, false, true) + return &PodmanSessionIntegration{podmanSession} +} + +// PodmanNoEvents calls the Podman command without an imagecache and without an +// events backend. It is used mostly for caching and uncaching images. +func (p *PodmanTestIntegration) PodmanNoEvents(args []string) *PodmanSessionIntegration { + podmanSession := p.PodmanBase(args, true, true) + return &PodmanSessionIntegration{podmanSession} +} + +func (p *PodmanTestIntegration) setDefaultRegistriesConfigEnv() { + defaultFile := filepath.Join(INTEGRATION_ROOT, "test/registries.conf") + os.Setenv("REGISTRIES_CONFIG_PATH", defaultFile) +} + +func (p *PodmanTestIntegration) setRegistriesConfigEnv(b []byte) { + outfile := filepath.Join(p.TempDir, "registries.conf") + os.Setenv("REGISTRIES_CONFIG_PATH", outfile) + ioutil.WriteFile(outfile, b, 0644) +} + +func resetRegistriesConfigEnv() { + os.Setenv("REGISTRIES_CONFIG_PATH", "") +} +func PodmanTestCreate(tempDir string) *PodmanTestIntegration { + pti := PodmanTestCreateUtil(tempDir, true) + pti.StartRemoteService() + return pti +} + +func (p *PodmanTestIntegration) StartRemoteService() { + if os.Geteuid() == 0 { + os.MkdirAll("/run/podman", 0755) + } + remoteSocket := p.RemoteSocket + args := []string{"system", "service", "--timeout", "0", remoteSocket} + podmanOptions := getRemoteOptions(p, args) + command := exec.Command(p.PodmanBinary, podmanOptions...) + fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) + command.Start() + command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} + p.RemoteCommand = command + p.RemoteSession = command.Process + err := p.DelayForService() + p.RemoteStartErr = err +} + +func (p *PodmanTestIntegration) StopRemoteService() { + var out bytes.Buffer + var pids []int + remoteSession := p.RemoteSession + + if !rootless.IsRootless() { + if err := remoteSession.Kill(); err != nil { + fmt.Fprintf(os.Stderr, "error on remote stop-kill %q", err) + } + if _, err := remoteSession.Wait(); err != nil { + fmt.Fprintf(os.Stderr, "error on remote stop-wait %q", err) + } + + } else { + //p.ResetVarlinkAddress() + parentPid := fmt.Sprintf("%d", p.RemoteSession.Pid) + pgrep := exec.Command("pgrep", "-P", parentPid) + fmt.Printf("running: pgrep %s\n", parentPid) + pgrep.Stdout = &out + err := pgrep.Run() + if err != nil { + fmt.Fprint(os.Stderr, "unable to find remote pid") + } + + for _, s := range strings.Split(out.String(), "\n") { + if len(s) == 0 { + continue + } + p, err := strconv.Atoi(s) + if err != nil { + fmt.Fprintf(os.Stderr, "unable to convert %s to int", s) + } + if p != 0 { + pids = append(pids, p) + } + } + + pids = append(pids, p.RemoteSession.Pid) + for _, pid := range pids { + syscall.Kill(pid, syscall.SIGKILL) + } + } + socket := strings.Split(p.RemoteSocket, ":")[1] + if err := os.Remove(socket); err != nil { + fmt.Println(err) + } +} + +//MakeOptions assembles all the podman main options +func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache bool) []string { + return args +} + +//MakeOptions assembles all the podman main options +func getRemoteOptions(p *PodmanTestIntegration, args []string) []string { + podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s", + p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ") + if os.Getenv("HOOK_OPTION") != "" { + podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION")) + } + podmanOptions = append(podmanOptions, strings.Split(p.StorageOptions, " ")...) + podmanOptions = append(podmanOptions, args...) + return podmanOptions +} + +func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error { + fmt.Printf("Restoring %s...\n", image) + dest := strings.Split(image, "/") + destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1)) + p.CrioRoot = p.ImageCacheDir + restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName}) + restore.WaitWithDefaultTimeout() + return nil +} + +// SeedImages restores all the artifacts into the main store for remote tests +func (p *PodmanTestIntegration) SeedImages() error { + return p.RestoreAllArtifacts() +} + +// RestoreArtifact puts the cached image into our test store +func (p *PodmanTestIntegration) RestoreArtifact(image string) error { + fmt.Printf("Restoring %s...\n", image) + dest := strings.Split(image, "/") + destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1)) + args := []string{"load", "-q", "-i", destName} + podmanOptions := getRemoteOptions(p, args) + command := exec.Command(p.PodmanBinary, podmanOptions...) + fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) + command.Start() + command.Wait() + return nil +} + +func (p *PodmanTestIntegration) DelayForService() error { + for i := 0; i < 5; i++ { + session := p.Podman([]string{"info"}) + session.WaitWithDefaultTimeout() + if session.ExitCode() == 0 { + return nil + } else if i == 4 { + break + } + time.Sleep(2 * time.Second) + } + return errors.New("Service not detected") +} + +func populateCache(podman *PodmanTestIntegration) {} +func removeCache() {} diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index d26f5784d..009f70914 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -127,8 +127,8 @@ func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error { return nil } -func (p *PodmanTestIntegration) StopVarlink() {} -func (p *PodmanTestIntegration) DelayForVarlink() {} +func (p *PodmanTestIntegration) StopRemoteService() {} +func (p *PodmanTestIntegration) DelayForVarlink() {} func populateCache(podman *PodmanTestIntegration) { for _, image := range CACHE_IMAGES { @@ -151,5 +151,5 @@ func (p *PodmanTestIntegration) SeedImages() error { } // We don't support running Varlink when local -func (p *PodmanTestIntegration) StartVarlink() { +func (p *PodmanTestIntegration) StartRemoteService() { } diff --git a/test/e2e/libpod_suite_remoteclient_test.go b/test/e2e/libpod_suite_varlink_test.go index b5da041ab..cbaed71cc 100644 --- a/test/e2e/libpod_suite_remoteclient_test.go +++ b/test/e2e/libpod_suite_varlink_test.go @@ -1,11 +1,10 @@ -// +build remoteclient +// +build remoteclientvarlink package integration import ( "bytes" "fmt" - "github.com/containers/libpod/pkg/rootless" "io/ioutil" "os" "os/exec" @@ -15,6 +14,8 @@ import ( "syscall" "time" + "github.com/containers/libpod/pkg/rootless" + "github.com/onsi/ginkgo" ) @@ -69,24 +70,24 @@ func resetRegistriesConfigEnv() { } func PodmanTestCreate(tempDir string) *PodmanTestIntegration { pti := PodmanTestCreateUtil(tempDir, true) - pti.StartVarlink() + pti.StartRemoteService() return pti } func (p *PodmanTestIntegration) ResetVarlinkAddress() { - os.Unsetenv("PODMAN_VARLINK_ADDRESS") + //os.Unsetenv("PODMAN_VARLINK_ADDRESS") } func (p *PodmanTestIntegration) SetVarlinkAddress(addr string) { - os.Setenv("PODMAN_VARLINK_ADDRESS", addr) + //os.Setenv("PODMAN_VARLINK_ADDRESS", addr) } func (p *PodmanTestIntegration) StartVarlink() { if os.Geteuid() == 0 { os.MkdirAll("/run/podman", 0755) } - varlinkEndpoint := p.VarlinkEndpoint - p.SetVarlinkAddress(p.VarlinkEndpoint) + varlinkEndpoint := p.RemoteSocket + p.SetVarlinkAddress(p.RemoteSocket) args := []string{"varlink", "--timeout", "0", varlinkEndpoint} podmanOptions := getVarlinkOptions(p, args) @@ -94,15 +95,15 @@ func (p *PodmanTestIntegration) StartVarlink() { fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) command.Start() command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} - p.VarlinkCommand = command - p.VarlinkSession = command.Process - p.DelayForVarlink() + p.RemoteCommand = command + p.RemoteSession = command.Process + p.DelayForService() } func (p *PodmanTestIntegration) StopVarlink() { var out bytes.Buffer var pids []int - varlinkSession := p.VarlinkSession + varlinkSession := p.RemoteSession if !rootless.IsRootless() { if err := varlinkSession.Kill(); err != nil { @@ -114,7 +115,7 @@ func (p *PodmanTestIntegration) StopVarlink() { } else { p.ResetVarlinkAddress() - parentPid := fmt.Sprintf("%d", p.VarlinkSession.Pid) + parentPid := fmt.Sprintf("%d", p.RemoteSession.Pid) pgrep := exec.Command("pgrep", "-P", parentPid) fmt.Printf("running: pgrep %s\n", parentPid) pgrep.Stdout = &out @@ -136,12 +137,12 @@ func (p *PodmanTestIntegration) StopVarlink() { } } - pids = append(pids, p.VarlinkSession.Pid) + pids = append(pids, p.RemoteSession.Pid) for _, pid := range pids { syscall.Kill(pid, syscall.SIGKILL) } } - socket := strings.Split(p.VarlinkEndpoint, ":")[1] + socket := strings.Split(p.RemoteSocket, ":")[1] if err := os.Remove(socket); err != nil { fmt.Println(err) } diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 0438a31cb..8924db670 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -19,6 +19,7 @@ var _ = Describe("Podman logs", func() { ) BeforeEach(func() { + SkipIfRemote() // v2remotefail tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) @@ -172,6 +173,24 @@ var _ = Describe("Podman logs", func() { Expect(string(out)).To(ContainSubstring("alpine")) }) + It("podman journald logs for container name", func() { + Skip("need to verify images have correct packages for journald") + containerName := "inside-journal" + logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-d", "--name", containerName, ALPINE, "sh", "-c", "echo podman; sleep 0.1; echo podman; sleep 0.1; echo podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc.ExitCode()).To(Equal(0)) + cid := logc.OutputToString() + + wait := podmanTest.Podman([]string{"wait", "-l"}) + wait.WaitWithDefaultTimeout() + Expect(wait.ExitCode()).To(BeZero()) + + cmd := exec.Command("journalctl", "--no-pager", "-o", "json", "--output-fields=CONTAINER_NAME", "-u", fmt.Sprintf("libpod-conmon-%s.scope", cid)) + out, err := cmd.CombinedOutput() + Expect(err).To(BeNil()) + Expect(string(out)).To(ContainSubstring(containerName)) + }) + It("podman journald logs for container", func() { Skip("need to verify images have correct packages for journald") logc := podmanTest.Podman([]string{"run", "--log-driver", "journald", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"}) diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index f622bf042..c47e20276 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -102,6 +102,7 @@ var _ = Describe("Podman manifest", func() { }) It("podman manifest annotate", func() { + SkipIfRemote() session := podmanTest.Podman([]string{"manifest", "create", "foo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -154,6 +155,7 @@ var _ = Describe("Podman manifest", func() { }) It("podman manifest push", func() { + Skip(v2remotefail) session := podmanTest.Podman([]string{"manifest", "create", "foo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -183,6 +185,7 @@ var _ = Describe("Podman manifest", func() { }) It("podman manifest push purge", func() { + Skip(v2remotefail) session := podmanTest.Podman([]string{"manifest", "create", "foo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 8d575d7f9..e293876b9 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -105,6 +105,32 @@ var _ = Describe("Podman network", func() { Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue()) }) + It("podman network list --filter success", func() { + // Setup, use uuid to prevent conflict with other tests + uuid := stringid.GenerateNonCryptoID() + secondPath := filepath.Join(cniPath, fmt.Sprintf("%s.conflist", uuid)) + writeConf([]byte(secondConf), secondPath) + defer removeConf(secondPath) + + session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=bridge"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue()) + }) + + It("podman network list --filter failure", func() { + // Setup, use uuid to prevent conflict with other tests + uuid := stringid.GenerateNonCryptoID() + secondPath := filepath.Join(cniPath, fmt.Sprintf("%s.conflist", uuid)) + writeConf([]byte(secondConf), secondPath) + defer removeConf(secondPath) + + session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=test"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.LineInOutputContains("podman-integrationtest")).To(BeFalse()) + }) + It("podman network rm no args", func() { session := podmanTest.Podman([]string{"network", "rm"}) session.WaitWithDefaultTimeout() @@ -152,6 +178,19 @@ var _ = Describe("Podman network", func() { Expect(session.IsJSONOutputValid()).To(BeTrue()) }) + It("podman network inspect", func() { + // Setup, use uuid to prevent conflict with other tests + uuid := stringid.GenerateNonCryptoID() + secondPath := filepath.Join(cniPath, fmt.Sprintf("%s.conflist", uuid)) + writeConf([]byte(secondConf), secondPath) + defer removeConf(secondPath) + + session := podmanTest.Podman([]string{"network", "inspect", "podman-integrationtest", "--format", "{{.cniVersion}}"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.LineInOutputContains("0.3.0")).To(BeTrue()) + }) + It("podman inspect container single CNI network", func() { netName := "testNetSingleCNI" network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName}) diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index e0a10c202..e56db54a2 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -2,7 +2,9 @@ package integration import ( "fmt" + "io/ioutil" "os" + "path/filepath" "strings" . "github.com/containers/libpod/test/utils" @@ -28,7 +30,7 @@ var _ = Describe("Podman pod create", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -282,4 +284,26 @@ var _ = Describe("Podman pod create", func() { podCreate.WaitWithDefaultTimeout() Expect(podCreate.ExitCode()).To(Equal(125)) }) + + It("podman create pod and print id to external file", func() { + // Switch to temp dir and restore it afterwards + cwd, err := os.Getwd() + Expect(err).To(BeNil()) + Expect(os.Chdir(os.TempDir())).To(BeNil()) + targetPath := filepath.Join(os.TempDir(), "dir") + Expect(os.MkdirAll(targetPath, 0755)).To(BeNil()) + targetFile := filepath.Join(targetPath, "idFile") + defer Expect(os.RemoveAll(targetFile)).To(BeNil()) + defer Expect(os.Chdir(cwd)).To(BeNil()) + + session := podmanTest.Podman([]string{"pod", "create", "--name=abc", "--pod-id-file", targetFile}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + id, _ := ioutil.ReadFile(targetFile) + check := podmanTest.Podman([]string{"pod", "inspect", "abc"}) + check.WaitWithDefaultTimeout() + data := check.InspectPodToJSON() + Expect(data.ID).To(Equal(string(id))) + }) }) diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go index 3cc6fa9e8..9b6f9b657 100644 --- a/test/e2e/pod_infra_container_test.go +++ b/test/e2e/pod_infra_container_test.go @@ -29,7 +29,7 @@ var _ = Describe("Podman pod create", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index f87bbe047..8040adf1e 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -26,7 +26,7 @@ var _ = Describe("Podman pod inspect", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index a3efec46c..af3d2af73 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -27,7 +27,7 @@ var _ = Describe("Podman pod kill", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -100,6 +100,7 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill latest pod", func() { + SkipIfRemote() _, ec, podid := podmanTest.CreatePod("") Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go index 7067c9a87..df6e5482e 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -29,7 +29,7 @@ var _ = Describe("Podman pod pause", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/pod_pod_namespaces.go b/test/e2e/pod_pod_namespaces.go index 09f716806..806ec3884 100644 --- a/test/e2e/pod_pod_namespaces.go +++ b/test/e2e/pod_pod_namespaces.go @@ -29,7 +29,7 @@ var _ = Describe("Podman pod create", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go index d98383331..1711b55d4 100644 --- a/test/e2e/pod_prune_test.go +++ b/test/e2e/pod_prune_test.go @@ -26,7 +26,7 @@ var _ = Describe("Podman pod prune", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index 5f8712a7a..81d97b72d 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -28,7 +28,7 @@ var _ = Describe("Podman ps", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -83,6 +83,7 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps latest", func() { + SkipIfRemote() _, ec, podid1 := podmanTest.CreatePod("") Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go index 691fe5f0c..72e804353 100644 --- a/test/e2e/pod_restart_test.go +++ b/test/e2e/pod_restart_test.go @@ -26,7 +26,7 @@ var _ = Describe("Podman pod restart", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -134,6 +134,7 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart latest pod", func() { + SkipIfRemote() _, ec, _ := podmanTest.CreatePod("foobar99") Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index 90f178be6..e10b3c98f 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -29,7 +29,7 @@ var _ = Describe("Podman pod rm", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -60,6 +60,7 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm latest pod", func() { + SkipIfRemote() _, ec, podid := podmanTest.CreatePod("") Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go index 2722cb5b3..8e78cadfd 100644 --- a/test/e2e/pod_start_test.go +++ b/test/e2e/pod_start_test.go @@ -26,7 +26,7 @@ var _ = Describe("Podman pod start", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -103,6 +103,7 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start latest pod", func() { + SkipIfRemote() _, ec, _ := podmanTest.CreatePod("foobar99") Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index 347f33e62..9bba59073 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -35,7 +35,7 @@ var _ = Describe("Podman pod stats", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go index a61917adb..298f3da2f 100644 --- a/test/e2e/pod_stop_test.go +++ b/test/e2e/pod_stop_test.go @@ -26,7 +26,7 @@ var _ = Describe("Podman pod stop", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) @@ -144,6 +144,7 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop latest pod", func() { + SkipIfRemote() _, ec, _ := podmanTest.CreatePod("foobar99") Expect(ec).To(Equal(0)) diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go index c313b0675..de011eda7 100644 --- a/test/e2e/pod_top_test.go +++ b/test/e2e/pod_top_test.go @@ -30,7 +30,7 @@ var _ = Describe("Podman top", func() { }) AfterEach(func() { - podmanTest.CleanupPod() + podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index a09b6f37a..e77e6dd25 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -168,12 +168,13 @@ var _ = Describe("Podman prune", func() { session = podmanTest.Podman([]string{"pod", "create"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + podid1 := session.OutputToString() - session = podmanTest.Podman([]string{"pod", "start", "-l"}) + session = podmanTest.Podman([]string{"pod", "start", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", "-l"}) + session = podmanTest.Podman([]string{"pod", "stop", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -196,13 +197,14 @@ var _ = Describe("Podman prune", func() { session := podmanTest.Podman([]string{"pod", "create"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + podid1 := session.OutputToString() // Start and stop a pod to get it in exited state. - session = podmanTest.Podman([]string{"pod", "start", "-l"}) + session = podmanTest.Podman([]string{"pod", "start", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", "-l"}) + session = podmanTest.Podman([]string{"pod", "stop", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -224,17 +226,17 @@ var _ = Describe("Podman prune", func() { }) It("podman system prune with running, exited pod and volume prune set true", func() { - // Start and stop a pod to get it in exited state. session := podmanTest.Podman([]string{"pod", "create"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + podid1 := session.OutputToString() - session = podmanTest.Podman([]string{"pod", "start", "-l"}) + session = podmanTest.Podman([]string{"pod", "start", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", "-l"}) + session = podmanTest.Podman([]string{"pod", "stop", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -242,7 +244,9 @@ var _ = Describe("Podman prune", func() { session = podmanTest.Podman([]string{"pod", "create"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "start", "-l"}) + podid2 := session.OutputToString() + + session = podmanTest.Podman([]string{"pod", "start", podid2}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -302,13 +306,14 @@ var _ = Describe("Podman prune", func() { session := podmanTest.Podman([]string{"pod", "create"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) + podid1 := session.OutputToString() // Start and stop a pod to get it in exited state. - session = podmanTest.Podman([]string{"pod", "start", "-l"}) + session = podmanTest.Podman([]string{"pod", "start", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - session = podmanTest.Podman([]string{"pod", "stop", "-l"}) + session = podmanTest.Podman([]string{"pod", "stop", podid1}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -317,9 +322,6 @@ var _ = Describe("Podman prune", func() { create.WaitWithDefaultTimeout() Expect(create.ExitCode()).To(Equal(0)) - // Adding images should be pruned - podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true") - // Adding unused volume should not be pruned as volumes not set session = podmanTest.Podman([]string{"volume", "create"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index b987c3ff4..8965ce297 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -101,6 +101,7 @@ var _ = Describe("Podman ps", func() { }) It("podman ps latest flag", func() { + SkipIfRemote() _, ec, _ := podmanTest.RunLsContainer("") Expect(ec).To(Equal(0)) diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index 2b515f53b..e72a20f2d 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -122,6 +122,7 @@ var _ = Describe("Podman restart", func() { }) It("Podman restart the latest container", func() { + SkipIfRemote() _, exitCode, _ := podmanTest.RunLsContainer("test1") Expect(exitCode).To(Equal(0)) diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go index 4eb568879..87e3de922 100644 --- a/test/e2e/rm_test.go +++ b/test/e2e/rm_test.go @@ -123,6 +123,7 @@ var _ = Describe("Podman rm", func() { }) It("podman rm the latest container", func() { + SkipIfRemote() session := podmanTest.Podman([]string{"create", ALPINE, "ls"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 6c0b01bd5..150726ce4 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -75,6 +75,7 @@ var _ = Describe("Podman rmi", func() { }) It("podman rmi tagged image", func() { + Skip(v2remotefail) setup := podmanTest.PodmanNoCache([]string{"images", "-q", ALPINE}) setup.WaitWithDefaultTimeout() Expect(setup).Should(Exit(0)) @@ -91,6 +92,7 @@ var _ = Describe("Podman rmi", func() { }) It("podman rmi image with tags by ID cannot be done without force", func() { + Skip(v2remotefail) setup := podmanTest.PodmanNoCache([]string{"images", "-q", ALPINE}) setup.WaitWithDefaultTimeout() Expect(setup).Should(Exit(0)) diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 6a93da085..9db2f5d49 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -19,7 +19,6 @@ var _ = Describe("Podman run networking", func() { ) BeforeEach(func() { - SkipIfRootlessV2() tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) @@ -193,6 +192,8 @@ var _ = Describe("Podman run networking", func() { }) It("podman run network expose duplicate host port results in error", func() { + SkipIfRootless() + session := podmanTest.Podman([]string{"run", "-dt", "-p", "80", ALPINE, "/bin/sh"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -202,7 +203,7 @@ var _ = Describe("Podman run networking", func() { Expect(inspect.ExitCode()).To(Equal(0)) containerConfig := inspect.InspectContainerToJSON() - Expect(containerConfig[0].NetworkSettings.Ports[0].HostPort).ToNot(Equal("80")) + Expect(containerConfig[0].NetworkSettings.Ports[0].HostPort).ToNot(Equal(80)) }) It("podman run hostname test", func() { diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index 1f892d9f8..58091ff68 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -117,7 +117,7 @@ var _ = Describe("Podman run with volumes", func() { session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=" + dest, ALPINE, "grep", dest, "/proc/self/mountinfo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring(dest + " rw,nosuid,nodev,noexec,relatime - tmpfs")) + Expect(session.OutputToString()).To(ContainSubstring(dest + " rw,nosuid,nodev,relatime - tmpfs")) session = podmanTest.Podman([]string{"run", "--rm", "--mount", "type=tmpfs,target=/etc/ssl,tmpcopyup", ALPINE, "ls", "/etc/ssl"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index 6af0b7068..b8198a3a9 100644 --- a/test/e2e/start_test.go +++ b/test/e2e/start_test.go @@ -120,11 +120,11 @@ var _ = Describe("Podman start", func() { }) It("podman failed to start with --rm should delete the container", func() { - session := podmanTest.Podman([]string{"create", "-it", "--rm", ALPINE, "foo"}) + session := podmanTest.Podman([]string{"create", "--name", "test1", "-it", "--rm", ALPINE, "foo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - start := podmanTest.Podman([]string{"start", "-l"}) + start := podmanTest.Podman([]string{"start", "test1"}) start.WaitWithDefaultTimeout() Expect(start).To(ExitWithError()) @@ -136,7 +136,7 @@ var _ = Describe("Podman start", func() { session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) - start := podmanTest.Podman([]string{"start", "-l"}) + start := podmanTest.Podman([]string{"start", session.OutputToString()}) start.WaitWithDefaultTimeout() Expect(start).To(ExitWithError()) diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index 54c64d66b..cd78a54e1 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -184,6 +184,7 @@ var _ = Describe("Podman stop", func() { }) It("podman stop latest containers", func() { + SkipIfRemote() session := podmanTest.RunTopContainer("test1") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go index e5ce69739..f45ff0c5f 100644 --- a/test/e2e/system_reset_test.go +++ b/test/e2e/system_reset_test.go @@ -34,6 +34,7 @@ var _ = Describe("podman system reset", func() { }) It("podman system reset", func() { + Skip(v2remotefail) // system reset will not remove additional store images, so need to grab length session := podmanTest.Podman([]string{"rmi", "--force", "--all"}) @@ -63,7 +64,7 @@ var _ = Describe("podman system reset", func() { // If remote then the varlink service should have exited // On local tests this is a noop - podmanTest.StartVarlink() + podmanTest.StartRemoteService() session = podmanTest.Podman([]string{"images", "-n"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go index 17171cd41..dc1a6208e 100644 --- a/test/e2e/untag_test.go +++ b/test/e2e/untag_test.go @@ -58,7 +58,7 @@ var _ = Describe("Podman untag", func() { results := podmanTest.PodmanNoCache([]string{"images"}) results.WaitWithDefaultTimeout() Expect(results.ExitCode()).To(Equal(0)) - Expect(results.OutputToStringArray()).To(HaveLen(5)) + Expect(results.OutputToStringArray()).To(HaveLen(6)) Expect(results.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue()) Expect(results.LineInOuputStartsWith("localhost/foo")).To(BeTrue()) Expect(results.LineInOuputStartsWith("localhost/bar")).To(BeTrue()) |