diff options
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/common_test.go | 38 | ||||
-rw-r--r-- | test/e2e/exists_test.go | 6 | ||||
-rw-r--r-- | test/e2e/generate_kube_test.go | 104 | ||||
-rw-r--r-- | test/e2e/kill_test.go | 16 | ||||
-rw-r--r-- | test/e2e/network_connect_disconnect_test.go | 20 | ||||
-rw-r--r-- | test/e2e/network_test.go | 68 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 35 | ||||
-rw-r--r-- | test/e2e/pod_inspect_test.go | 2 | ||||
-rw-r--r-- | test/e2e/pod_kill_test.go | 16 | ||||
-rw-r--r-- | test/e2e/pod_pause_test.go | 8 | ||||
-rw-r--r-- | test/e2e/pod_prune_test.go | 6 | ||||
-rw-r--r-- | test/e2e/pod_ps_test.go | 59 | ||||
-rw-r--r-- | test/e2e/pod_restart_test.go | 18 | ||||
-rw-r--r-- | test/e2e/pod_rm_test.go | 24 | ||||
-rw-r--r-- | test/e2e/pod_start_test.go | 49 | ||||
-rw-r--r-- | test/e2e/pod_stats_test.go | 16 | ||||
-rw-r--r-- | test/e2e/pod_stop_test.go | 22 | ||||
-rw-r--r-- | test/e2e/pod_top_test.go | 12 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 4 | ||||
-rw-r--r-- | test/e2e/restart_test.go | 26 | ||||
-rw-r--r-- | test/e2e/run_networking_test.go | 7 | ||||
-rw-r--r-- | test/e2e/run_volume_test.go | 2 | ||||
-rw-r--r-- | test/e2e/stop_test.go | 41 | ||||
-rw-r--r-- | test/e2e/wait_test.go | 4 |
24 files changed, 459 insertions, 144 deletions
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 781bbb6d2..54d801e12 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -1,6 +1,7 @@ package integration import ( + "bytes" "fmt" "io/ioutil" "math/rand" @@ -440,7 +441,7 @@ func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755) Expect(err).To(BeNil()) session := p.Podman([]string{"build", "--layers=" + layers, "-t", imageName, "--file", dockerfilePath, p.TempDir}) - session.Wait(120) + session.Wait(240) Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString())) } @@ -517,27 +518,15 @@ func (s *PodmanSessionIntegration) InspectPodArrToJSON() []define.InspectPodData // CreatePod creates a pod with no infra container // it optionally takes a pod name -func (p *PodmanTestIntegration) CreatePod(name string) (*PodmanSessionIntegration, int, string) { - var podmanArgs = []string{"pod", "create", "--infra=false", "--share", ""} - if name != "" { - podmanArgs = append(podmanArgs, "--name", name) +func (p *PodmanTestIntegration) CreatePod(options map[string][]string) (*PodmanSessionIntegration, int, string) { + var args = []string{"pod", "create", "--infra=false", "--share", ""} + for k, values := range options { + for _, v := range values { + args = append(args, k+"="+v) + } } - session := p.Podman(podmanArgs) - session.WaitWithDefaultTimeout() - return session, session.ExitCode(), session.OutputToString() -} -// CreatePod creates a pod with no infra container and some labels. -// it optionally takes a pod name -func (p *PodmanTestIntegration) CreatePodWithLabels(name string, labels map[string]string) (*PodmanSessionIntegration, int, string) { - var podmanArgs = []string{"pod", "create", "--infra=false", "--share", ""} - if name != "" { - podmanArgs = append(podmanArgs, "--name", name) - } - for labelKey, labelValue := range labels { - podmanArgs = append(podmanArgs, "--label", fmt.Sprintf("%s=%s", labelKey, labelValue)) - } - session := p.Podman(podmanArgs) + session := p.Podman(args) session.WaitWithDefaultTimeout() return session, session.ExitCode(), session.OutputToString() } @@ -794,3 +783,12 @@ func (p *PodmanTestIntegration) removeCNINetwork(name string) { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(BeNumerically("<=", 1)) } + +func (p *PodmanSessionIntegration) jq(jqCommand string) (string, error) { + var out bytes.Buffer + cmd := exec.Command("jq", jqCommand) + cmd.Stdin = strings.NewReader(p.OutputToString()) + cmd.Stdout = &out + err := cmd.Run() + return strings.TrimRight(out.String(), "\n"), err +} diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go index 480bfe5fc..306e8c250 100644 --- a/test/e2e/exists_test.go +++ b/test/e2e/exists_test.go @@ -83,7 +83,7 @@ var _ = Describe("Podman image|container exists", func() { }) It("podman pod exists in local storage by name", func() { - setup, _, _ := podmanTest.CreatePod("foobar") + setup, _, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar"}}) setup.WaitWithDefaultTimeout() Expect(setup).Should(Exit(0)) @@ -92,7 +92,7 @@ var _ = Describe("Podman image|container exists", func() { Expect(session).Should(Exit(0)) }) It("podman pod exists in local storage by container ID", func() { - setup, _, podID := podmanTest.CreatePod("") + setup, _, podID := podmanTest.CreatePod(nil) setup.WaitWithDefaultTimeout() Expect(setup).Should(Exit(0)) @@ -101,7 +101,7 @@ var _ = Describe("Podman image|container exists", func() { Expect(session).Should(Exit(0)) }) It("podman pod exists in local storage by short container ID", func() { - setup, _, podID := podmanTest.CreatePod("") + setup, _, podID := podmanTest.CreatePod(nil) setup.WaitWithDefaultTimeout() Expect(setup).Should(Exit(0)) diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index 8800f9057..bcfab0f68 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -1,6 +1,7 @@ package integration import ( + "io/ioutil" "os" "path/filepath" "strconv" @@ -60,6 +61,7 @@ var _ = Describe("Podman generate kube", func() { pod := new(v1.Pod) err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) + Expect(pod.Spec.HostNetwork).To(Equal(false)) numContainers := 0 for range pod.Spec.Containers { @@ -130,7 +132,7 @@ var _ = Describe("Podman generate kube", func() { }) It("podman generate kube on pod", func() { - _, rc, _ := podmanTest.CreatePod("toppod") + _, rc, _ := podmanTest.CreatePod(map[string][]string{"--name": {"toppod"}}) Expect(rc).To(Equal(0)) session := podmanTest.RunTopContainerInPod("topcontainer", "toppod") @@ -144,6 +146,7 @@ var _ = Describe("Podman generate kube", func() { pod := new(v1.Pod) err := yaml.Unmarshal(kube.Out.Contents(), pod) Expect(err).To(BeNil()) + Expect(pod.Spec.HostNetwork).To(Equal(false)) numContainers := 0 for range pod.Spec.Containers { @@ -152,6 +155,40 @@ var _ = Describe("Podman generate kube", func() { Expect(numContainers).To(Equal(1)) }) + It("podman generate kube on pod with host network", func() { + podSession := podmanTest.Podman([]string{"pod", "create", "--name", "testHostNetwork", "--network", "host"}) + podSession.WaitWithDefaultTimeout() + Expect(podSession.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"create", "--name", "topcontainer", "--pod", "testHostNetwork", "--network", "host", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", "testHostNetwork"}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + pod := new(v1.Pod) + err := yaml.Unmarshal(kube.Out.Contents(), pod) + Expect(err).To(BeNil()) + Expect(pod.Spec.HostNetwork).To(Equal(true)) + }) + + It("podman generate kube on container with host network", func() { + session := podmanTest.RunTopContainerWithArgs("topcontainer", []string{"--network", "host"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", "topcontainer"}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + pod := new(v1.Pod) + err := yaml.Unmarshal(kube.Out.Contents(), pod) + Expect(err).To(BeNil()) + Expect(pod.Spec.HostNetwork).To(Equal(true)) + }) + It("podman generate kube on pod with hostAliases", func() { podName := "testHost" testIP := "127.0.0.1" @@ -185,7 +222,7 @@ var _ = Describe("Podman generate kube", func() { }) It("podman generate service kube on pod", func() { - _, rc, _ := podmanTest.CreatePod("toppod") + _, rc, _ := podmanTest.CreatePod(map[string][]string{"--name": {"toppod"}}) Expect(rc).To(Equal(0)) session := podmanTest.RunTopContainerInPod("topcontainer", "toppod") @@ -337,7 +374,7 @@ var _ = Describe("Podman generate kube", func() { It("podman generate and reimport kube on pod", func() { podName := "toppod" - _, rc, _ := podmanTest.CreatePod(podName) + _, rc, _ := podmanTest.CreatePod(map[string][]string{"--name": {podName}}) Expect(rc).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test1", ALPINE, "top"}) @@ -376,7 +413,7 @@ var _ = Describe("Podman generate kube", func() { It("podman generate with user and reimport kube on pod", func() { podName := "toppod" - _, rc, _ := podmanTest.CreatePod(podName) + _, rc, _ := podmanTest.CreatePod(map[string][]string{"--name": {podName}}) Expect(rc).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test1", "--user", "100:200", ALPINE, "top"}) @@ -603,4 +640,63 @@ var _ = Describe("Podman generate kube", func() { Expect(pod.Spec.DNSConfig.Options[0].Name).To(Equal("color")) Expect(*pod.Spec.DNSConfig.Options[0].Value).To(Equal("blue")) }) + + It("podman generate kube - set entrypoint as command", func() { + session := podmanTest.Podman([]string{"create", "--pod", "new:testpod", "--entrypoint", "/bin/sleep", ALPINE, "10s"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", "testpod"}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + // Now make sure that the container's command is set to the + // entrypoint and it's arguments to "10s". + pod := new(v1.Pod) + err := yaml.Unmarshal(kube.Out.Contents(), pod) + Expect(err).To(BeNil()) + + containers := pod.Spec.Containers + Expect(len(containers)).To(Equal(1)) + + Expect(containers[0].Command).To(Equal([]string{"/bin/sleep"})) + Expect(containers[0].Args).To(Equal([]string{"10s"})) + }) + + It("podman generate kube - use entrypoint from image", func() { + // Build an image with an entrypoint. + containerfile := `FROM quay.io/libpod/alpine:latest +ENTRYPOINT /bin/sleep` + + targetPath, err := CreateTempDirInTempDir() + Expect(err).To(BeNil()) + containerfilePath := filepath.Join(targetPath, "Containerfile") + err = ioutil.WriteFile(containerfilePath, []byte(containerfile), 0644) + Expect(err).To(BeNil()) + + image := "generatekube:test" + session := podmanTest.Podman([]string{"build", "-f", containerfilePath, "-t", image}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"create", "--pod", "new:testpod", image, "10s"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + kube := podmanTest.Podman([]string{"generate", "kube", "testpod"}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + // Now make sure that the container's command is set to the + // entrypoint and it's arguments to "10s". + pod := new(v1.Pod) + err = yaml.Unmarshal(kube.Out.Contents(), pod) + Expect(err).To(BeNil()) + + containers := pod.Spec.Containers + Expect(len(containers)).To(Equal(1)) + + Expect(containers[0].Command).To(Equal([]string{"/bin/sh", "-c", "/bin/sleep"})) + Expect(containers[0].Args).To(Equal([]string{"10s"})) + }) }) diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go index 8b31cae72..c1c1b003e 100644 --- a/test/e2e/kill_test.go +++ b/test/e2e/kill_test.go @@ -167,4 +167,20 @@ var _ = Describe("Podman kill", func() { Expect(wait.ExitCode()).To(BeZero()) }) + It("podman stop --all", func() { + session := podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + + session = podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) + + session = podmanTest.Podman([]string{"kill", "--all"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) }) diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go index dd94bd7ca..cc23b10c1 100644 --- a/test/e2e/network_connect_disconnect_test.go +++ b/test/e2e/network_connect_disconnect_test.go @@ -74,6 +74,11 @@ var _ = Describe("Podman network connect and disconnect", func() { dis.WaitWithDefaultTimeout() Expect(dis.ExitCode()).To(BeZero()) + inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + Expect(inspect.OutputToString()).To(Equal("0")) + exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec.WaitWithDefaultTimeout() Expect(exec.ExitCode()).ToNot(BeZero()) @@ -146,6 +151,11 @@ var _ = Describe("Podman network connect and disconnect", func() { connect.WaitWithDefaultTimeout() Expect(connect.ExitCode()).To(BeZero()) + inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + Expect(inspect.OutputToString()).To(Equal("2")) + exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"}) exec.WaitWithDefaultTimeout() Expect(exec.ExitCode()).To(BeZero()) @@ -167,6 +177,11 @@ var _ = Describe("Podman network connect and disconnect", func() { dis.WaitWithDefaultTimeout() Expect(dis.ExitCode()).To(BeZero()) + inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + Expect(inspect.OutputToString()).To(Equal("2")) + start := podmanTest.Podman([]string{"start", "test"}) start.WaitWithDefaultTimeout() Expect(start.ExitCode()).To(BeZero()) @@ -202,6 +217,11 @@ var _ = Describe("Podman network connect and disconnect", func() { dis.WaitWithDefaultTimeout() Expect(dis.ExitCode()).To(BeZero()) + inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{len .NetworkSettings.Networks}}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + Expect(inspect.OutputToString()).To(Equal("1")) + start := podmanTest.Podman([]string{"start", "test"}) start.WaitWithDefaultTimeout() Expect(start.ExitCode()).To(BeZero()) diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 2f5290c76..c6010ba43 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -457,6 +457,46 @@ var _ = Describe("Podman network", func() { Expect(nc.ExitCode()).To(Equal(0)) }) + It("podman network create/remove macvlan as driver (-d) no device name", func() { + net := "macvlan" + stringid.GenerateNonCryptoID() + nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", net}) + nc.WaitWithDefaultTimeout() + defer podmanTest.removeCNINetwork(net) + Expect(nc.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"network", "inspect", net}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + + out, err := inspect.jq(".[0].plugins[0].master") + Expect(err).To(BeNil()) + Expect(out).To(Equal("\"\"")) + + nc = podmanTest.Podman([]string{"network", "rm", net}) + nc.WaitWithDefaultTimeout() + Expect(nc.ExitCode()).To(Equal(0)) + }) + + It("podman network create/remove macvlan as driver (-d) with device name", func() { + net := "macvlan" + stringid.GenerateNonCryptoID() + nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", net}) + nc.WaitWithDefaultTimeout() + defer podmanTest.removeCNINetwork(net) + Expect(nc.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"network", "inspect", net}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + + out, err := inspect.jq(".[0].plugins[0].master") + Expect(err).To(BeNil()) + Expect(out).To(Equal("\"lo\"")) + + nc = podmanTest.Podman([]string{"network", "rm", net}) + nc.WaitWithDefaultTimeout() + Expect(nc.ExitCode()).To(Equal(0)) + }) + It("podman network exists", func() { net := "net" + stringid.GenerateNonCryptoID() session := podmanTest.Podman([]string{"network", "create", net}) @@ -472,4 +512,32 @@ var _ = Describe("Podman network", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(1)) }) + + It("podman network create macvlan with network info and options", func() { + net := "macvlan" + stringid.GenerateNonCryptoID() + nc := podmanTest.Podman([]string{"network", "create", "-d", "macvlan", "-o", "parent=lo", "-o", "mtu=1500", "--gateway", "192.168.1.254", "--subnet", "192.168.1.0/24", net}) + nc.WaitWithDefaultTimeout() + defer podmanTest.removeCNINetwork(net) + Expect(nc.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"network", "inspect", net}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(BeZero()) + + mtu, err := inspect.jq(".[0].plugins[0].mtu") + Expect(err).To(BeNil()) + Expect(mtu).To(Equal("1500")) + + gw, err := inspect.jq(".[0].plugins[0].ipam.ranges[0][0].gateway") + Expect(err).To(BeNil()) + Expect(gw).To(Equal("\"192.168.1.254\"")) + + subnet, err := inspect.jq(".[0].plugins[0].ipam.ranges[0][0].subnet") + Expect(err).To(BeNil()) + Expect(subnet).To(Equal("\"192.168.1.0/24\"")) + + nc = podmanTest.Podman([]string{"network", "rm", net}) + nc.WaitWithDefaultTimeout() + Expect(nc.ExitCode()).To(Equal(0)) + }) }) diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 9c448a81e..e57712f62 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -38,7 +38,7 @@ var _ = Describe("Podman pod create", func() { }) It("podman create pod", func() { - _, ec, podID := podmanTest.CreatePod("") + _, ec, podID := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) check := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc"}) @@ -50,7 +50,7 @@ var _ = Describe("Podman pod create", func() { It("podman create pod with name", func() { name := "test" - _, ec, _ := podmanTest.CreatePod(name) + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}}) Expect(ec).To(Equal(0)) check := podmanTest.Podman([]string{"pod", "ps", "--no-trunc"}) @@ -61,10 +61,10 @@ var _ = Describe("Podman pod create", func() { It("podman create pod with doubled name", func() { name := "test" - _, ec, _ := podmanTest.CreatePod(name) + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}}) Expect(ec).To(Equal(0)) - _, ec2, _ := podmanTest.CreatePod(name) + _, ec2, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}}) Expect(ec2).To(Not(Equal(0))) check := podmanTest.Podman([]string{"pod", "ps", "-q"}) @@ -78,7 +78,7 @@ var _ = Describe("Podman pod create", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ := podmanTest.CreatePod(name) + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {name}}) Expect(ec).To(Not(Equal(0))) check := podmanTest.Podman([]string{"pod", "ps", "-q"}) @@ -476,4 +476,29 @@ entrypoint ["/fromimage"] Expect(status3.ExitCode()).To(Equal(0)) Expect(strings.Contains(status3.OutputToString(), "Degraded")).To(BeTrue()) }) + + It("podman create with unsupported network options", func() { + podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "container:doesnotmatter"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(125)) + Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode container")) + + podCreate = podmanTest.Podman([]string{"pod", "create", "--network", "ns:/does/not/matter"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(125)) + Expect(podCreate.ErrorToString()).To(ContainSubstring("pods presently do not support network mode path")) + }) + + It("podman pod create with --net=none", func() { + podName := "testPod" + podCreate := podmanTest.Podman([]string{"pod", "create", "--network", "none", "--name", podName}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(0)) + + session := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "ip", "-o", "-4", "addr"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("inet 127.0.0.1/8 scope host lo")) + Expect(len(session.OutputToStringArray())).To(Equal(1)) + }) }) diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index fd9589afe..d9c4a393a 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -41,7 +41,7 @@ var _ = Describe("Podman pod inspect", func() { }) It("podman inspect a pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 710147893..06d244f99 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -40,7 +40,7 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by id", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -58,7 +58,7 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by id with TERM", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -72,7 +72,7 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by name", func() { - _, ec, podid := podmanTest.CreatePod("test1") + _, ec, podid := podmanTest.CreatePod(map[string][]string{"--name": {"test1"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -86,7 +86,7 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill a pod by id with a bogus signal", func() { - _, ec, podid := podmanTest.CreatePod("test1") + _, ec, podid := podmanTest.CreatePod(map[string][]string{"--name": {"test1"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -100,14 +100,14 @@ var _ = Describe("Podman pod kill", func() { }) It("podman pod kill latest pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, podid2 := podmanTest.CreatePod("") + _, ec, podid2 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", podid2) @@ -128,7 +128,7 @@ var _ = Describe("Podman pod kill", func() { It("podman pod kill all", func() { SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1") - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -139,7 +139,7 @@ var _ = Describe("Podman pod kill", func() { session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, podid2 := podmanTest.CreatePod("") + _, ec, podid2 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", podid2) diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go index 3dabf7b4a..0c1b39f38 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -48,7 +48,7 @@ var _ = Describe("Podman pod pause", func() { }) It("podman pod pause a created pod by id", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "pause", podid}) @@ -57,7 +57,7 @@ var _ = Describe("Podman pod pause", func() { }) It("podman pod pause a running pod by id", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -78,7 +78,7 @@ var _ = Describe("Podman pod pause", func() { }) It("podman unpause a running pod by id", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -93,7 +93,7 @@ var _ = Describe("Podman pod pause", func() { }) It("podman pod pause a running pod by name", func() { - _, ec, _ := podmanTest.CreatePod("test1") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"test1"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "test1") diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go index 0346cfdc8..d1ebf7249 100644 --- a/test/e2e/pod_prune_test.go +++ b/test/e2e/pod_prune_test.go @@ -33,7 +33,7 @@ var _ = Describe("Podman pod prune", func() { }) It("podman pod prune empty pod", func() { - _, ec, _ := podmanTest.CreatePod("") + _, ec, _ := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "prune", "--force"}) @@ -42,7 +42,7 @@ var _ = Describe("Podman pod prune", func() { }) It("podman pod prune doesn't remove a pod with a running container", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) ec2 := podmanTest.RunTopContainerInPod("", podid) @@ -59,7 +59,7 @@ var _ = Describe("Podman pod prune", func() { }) It("podman pod prune removes a pod with a stopped container", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) _, ec2, _ := podmanTest.RunLsContainerInPod("", podid) diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index 9f63c1d5d..c20cb44e7 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -43,7 +43,7 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps default", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -57,7 +57,7 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps quiet flag", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) _, ec, _ = podmanTest.RunLsContainerInPod("", podid) @@ -71,7 +71,7 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps no-trunc", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) _, ec2, _ := podmanTest.RunLsContainerInPod("", podid) @@ -86,10 +86,10 @@ var _ = Describe("Podman ps", func() { It("podman pod ps latest", func() { SkipIfRemote("--latest flag n/a") - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec2, podid2 := podmanTest.CreatePod("") + _, ec2, podid2 := podmanTest.CreatePod(nil) Expect(ec2).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--latest"}) @@ -100,7 +100,7 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps id filter flag", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "ps", "--filter", fmt.Sprintf("id=%s", podid)}) @@ -109,9 +109,9 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps filter name regexp", func() { - _, ec, podid := podmanTest.CreatePod("mypod") + _, ec, podid := podmanTest.CreatePod(map[string][]string{"--name": {"mypod"}}) Expect(ec).To(Equal(0)) - _, ec2, _ := podmanTest.CreatePod("mypod1") + _, ec2, _ := podmanTest.CreatePod(map[string][]string{"--name": {"mypod1"}}) Expect(ec2).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "name=mypod"}) @@ -138,13 +138,13 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps --sort by name", func() { - _, ec, _ := podmanTest.CreatePod("") + _, ec, _ := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec2, _ := podmanTest.CreatePod("") + _, ec2, _ := podmanTest.CreatePod(nil) Expect(ec2).To(Equal(0)) - _, ec3, _ := podmanTest.CreatePod("") + _, ec3, _ := podmanTest.CreatePod(nil) Expect(ec3).To(Equal(0)) session := podmanTest.Podman([]string{"pod", "ps", "--sort=name", "--format", "{{.Name}}"}) @@ -159,7 +159,7 @@ var _ = Describe("Podman ps", func() { It("podman pod ps --ctr-names", func() { SkipIfRootlessCgroupsV1("Not supported for rootless + CGroupsV1") - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", podid) @@ -177,14 +177,14 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps filter ctr attributes", func() { - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", podid1) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec2, podid2 := podmanTest.CreatePod("") + _, ec2, podid2 := podmanTest.CreatePod(nil) Expect(ec2).To(Equal(0)) _, ec3, cid := podmanTest.RunLsContainerInPod("test2", podid2) @@ -214,7 +214,7 @@ var _ = Describe("Podman ps", func() { Expect(session.OutputToString()).To(ContainSubstring(podid2)) Expect(session.OutputToString()).To(Not(ContainSubstring(podid1))) - _, ec3, podid3 := podmanTest.CreatePod("") + _, ec3, podid3 := podmanTest.CreatePod(nil) Expect(ec3).To(Equal(0)) session = podmanTest.Podman([]string{"pod", "ps", "-q", "--no-trunc", "--filter", "ctr-number=1"}) @@ -259,23 +259,20 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps filter labels", func() { - _, ec, podid1 := podmanTest.CreatePod("") - Expect(ec).To(Equal(0)) + s, _, podid1 := podmanTest.CreatePod(nil) + Expect(s).To(Exit(0)) - _, ec, podid2 := podmanTest.CreatePodWithLabels("", map[string]string{ - "app": "myapp", - "io.podman.test.key": "irrelevant-value", + s, _, podid2 := podmanTest.CreatePod(map[string][]string{ + "--label": {"app=myapp", "io.podman.test.key=irrelevant-value"}, }) - Expect(ec).To(Equal(0)) + Expect(s).To(Exit(0)) - _, ec, podid3 := podmanTest.CreatePodWithLabels("", map[string]string{ - "app": "test", - }) - Expect(ec).To(Equal(0)) + s, _, podid3 := podmanTest.CreatePod(map[string][]string{"--label": {"app=test"}}) + Expect(s).To(Exit(0)) session := podmanTest.Podman([]string{"pod", "ps", "--no-trunc", "--filter", "label=app", "--filter", "label=app=myapp"}) session.WaitWithDefaultTimeout() - Expect(session.ExitCode()).To(Equal(0)) + Expect(session).To(Exit(0)) Expect(session.OutputToString()).To(Not(ContainSubstring(podid1))) Expect(session.OutputToString()).To(ContainSubstring(podid2)) Expect(session.OutputToString()).To(Not(ContainSubstring(podid3))) @@ -359,13 +356,13 @@ var _ = Describe("Podman ps", func() { }) It("podman pod ps format with labels", func() { - _, ec, _ := podmanTest.CreatePod("") + _, ec, _ := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec1, _ := podmanTest.CreatePodWithLabels("", map[string]string{ - "io.podman.test.label": "value1", - "io.podman.test.key": "irrelevant-value", - }) + _, ec1, _ := podmanTest.CreatePod(map[string][]string{"--label": { + "io.podman.test.label=value1", + "io.podman.test.key=irrelevant-value", + }}) Expect(ec1).To(Equal(0)) session := podmanTest.Podman([]string{"pod", "ps", "--format", "{{.Labels}}"}) diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go index b358c2c7a..c6b1a0d46 100644 --- a/test/e2e/pod_restart_test.go +++ b/test/e2e/pod_restart_test.go @@ -39,7 +39,7 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart single empty pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"pod", "restart", podid}) @@ -48,7 +48,7 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart single pod by name", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", "foobar99") @@ -68,14 +68,14 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart multiple pods", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("test2", "foobar100") @@ -106,14 +106,14 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart all pods", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("test2", "foobar100") @@ -134,14 +134,14 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart latest pod", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("test2", "foobar100") @@ -166,7 +166,7 @@ var _ = Describe("Podman pod restart", func() { }) It("podman pod restart multiple pods with bogus", func() { - _, ec, podid1 := podmanTest.CreatePod("foobar99") + _, ec, podid1 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "foobar99") diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index 24e945d5a..40a903cd0 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -37,7 +37,7 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm empty pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"pod", "rm", podid}) @@ -61,10 +61,10 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm latest pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec2, podid2 := podmanTest.CreatePod("pod2") + _, ec2, podid2 := podmanTest.CreatePod(map[string][]string{"--name": {"pod2"}}) Expect(ec2).To(Equal(0)) latest := "--latest" @@ -83,7 +83,7 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm removes a pod with a container", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) _, ec2, _ := podmanTest.RunLsContainerInPod("", podid) @@ -99,7 +99,7 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm -f does remove a running container", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -117,10 +117,10 @@ var _ = Describe("Podman pod rm", func() { It("podman pod rm -a doesn't remove a running container", func() { fmt.Printf("To start, there are %d pods\n", podmanTest.NumberOfPods()) - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("") + _, ec, _ = podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) fmt.Printf("Started %d pods\n", podmanTest.NumberOfPods()) @@ -154,13 +154,13 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm -fa removes everything", func() { - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec, podid2 := podmanTest.CreatePod("") + _, ec, podid2 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("") + _, ec, _ = podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid1) @@ -199,7 +199,7 @@ var _ = Describe("Podman pod rm", func() { }) It("podman rm bogus pod and a running pod", func() { - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", podid1) @@ -217,7 +217,7 @@ var _ = Describe("Podman pod rm", func() { It("podman rm --ignore bogus pod and a running pod", func() { - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", podid1) diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go index 63a915548..e14796ab3 100644 --- a/test/e2e/pod_start_test.go +++ b/test/e2e/pod_start_test.go @@ -10,6 +10,7 @@ import ( . "github.com/containers/podman/v2/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" ) var _ = Describe("Podman pod start", func() { @@ -43,7 +44,7 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start single empty pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"pod", "start", podid}) @@ -52,7 +53,7 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start single pod by name", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "ls"}) @@ -65,14 +66,14 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start multiple pods", func() { - _, ec, podid1 := podmanTest.CreatePod("foobar99") + _, ec, podid1 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec2, podid2 := podmanTest.CreatePod("foobar100") + _, ec2, podid2 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec2).To(Equal(0)) session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"}) @@ -85,15 +86,45 @@ var _ = Describe("Podman pod start", func() { Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) }) + It("multiple pods in conflict", func() { + podName := []string{"Pod_" + RandomString(10), "Pod_" + RandomString(10)} + + pod, _, podid1 := podmanTest.CreatePod(map[string][]string{ + "--infra": {"true"}, + "--name": {podName[0]}, + "--publish": {"127.0.0.1:8080:80"}, + }) + Expect(pod).To(Exit(0)) + + session := podmanTest.Podman([]string{"create", "--pod", podName[0], ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session).To(Exit(0)) + + pod, _, podid2 := podmanTest.CreatePod(map[string][]string{ + "--infra": {"true"}, + "--name": {podName[1]}, + "--publish": {"127.0.0.1:8080:80"}, + }) + Expect(pod).To(Exit(0)) + + session = podmanTest.Podman([]string{"create", "--pod", podName[1], ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session).To(Exit(0)) + + session = podmanTest.Podman([]string{"pod", "start", podid1, podid2}) + session.WaitWithDefaultTimeout() + Expect(session).To(Exit(125)) + }) + It("podman pod start all pods", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"}) @@ -107,14 +138,14 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start latest pod", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.Podman([]string{"create", "--pod", "foobar100", ALPINE, "top"}) @@ -132,7 +163,7 @@ var _ = Describe("Podman pod start", func() { }) It("podman pod start multiple pods with bogus", func() { - _, ec, podid := podmanTest.CreatePod("foobar99") + _, ec, podid := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"create", "--pod", "foobar99", ALPINE, "top"}) diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index 1709b4f81..073d4752b 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -50,7 +50,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on a specific running pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -67,7 +67,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on a specific running pod with shortID", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -84,7 +84,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on a specific running pod with name", func() { - _, ec, podid := podmanTest.CreatePod("test") + _, ec, podid := podmanTest.CreatePod(map[string][]string{"--name": {"test"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -101,7 +101,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on running pods", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -118,7 +118,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats on all pods", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -135,7 +135,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats with json output", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -152,7 +152,7 @@ var _ = Describe("Podman pod stats", func() { Expect(stats.IsJSONOutputValid()).To(BeTrue()) }) It("podman stats with GO template", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -164,7 +164,7 @@ var _ = Describe("Podman pod stats", func() { }) It("podman stats with invalid GO template", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go index 4eb897786..30a5632d0 100644 --- a/test/e2e/pod_stop_test.go +++ b/test/e2e/pod_stop_test.go @@ -47,7 +47,7 @@ var _ = Describe("Podman pod stop", func() { }) It("podman stop bogus pod and a running pod", func() { - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", podid1) @@ -61,7 +61,7 @@ var _ = Describe("Podman pod stop", func() { It("podman stop --ignore bogus pod and a running pod", func() { - _, ec, podid1 := podmanTest.CreatePod("") + _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("test1", podid1) @@ -78,7 +78,7 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop single empty pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"pod", "stop", podid}) @@ -87,7 +87,7 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop single pod by name", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "foobar99") @@ -101,14 +101,14 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop multiple pods", func() { - _, ec, podid1 := podmanTest.CreatePod("foobar99") + _, ec, podid1 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec2, podid2 := podmanTest.CreatePod("foobar100") + _, ec2, podid2 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec2).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", "foobar100") @@ -122,14 +122,14 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop all pods", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", "foobar100") @@ -143,14 +143,14 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop latest pod", func() { - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "foobar99") session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - _, ec, _ = podmanTest.CreatePod("foobar100") + _, ec, _ = podmanTest.CreatePod(map[string][]string{"--name": {"foobar100"}}) Expect(ec).To(Equal(0)) session = podmanTest.RunTopContainerInPod("", "foobar100") @@ -168,7 +168,7 @@ var _ = Describe("Podman pod stop", func() { }) It("podman pod stop multiple pods with bogus", func() { - _, ec, podid1 := podmanTest.CreatePod("foobar99") + _, ec, podid1 := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", "foobar99") diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go index 9e3570360..e191b44fc 100644 --- a/test/e2e/pod_top_test.go +++ b/test/e2e/pod_top_test.go @@ -47,7 +47,7 @@ var _ = Describe("Podman top", func() { }) It("podman pod top on non-running pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) result := podmanTest.Podman([]string{"top", podid}) @@ -56,7 +56,7 @@ var _ = Describe("Podman top", func() { }) It("podman pod top on pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"}) @@ -73,7 +73,7 @@ var _ = Describe("Podman top", func() { }) It("podman pod top with options", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"}) @@ -87,7 +87,7 @@ var _ = Describe("Podman top", func() { }) It("podman pod top on pod invalid options", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"}) @@ -104,7 +104,7 @@ var _ = Describe("Podman top", func() { }) It("podman pod top on pod with containers in same pid namespace", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"}) @@ -123,7 +123,7 @@ var _ = Describe("Podman top", func() { }) It("podman pod top on pod with containers in different namespace", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.Podman([]string{"run", "-d", "--pod", podid, ALPINE, "top", "-d", "2"}) diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index d12534219..db3f7a36b 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -389,7 +389,7 @@ var _ = Describe("Podman ps", func() { }) It("podman --pod", func() { - _, ec, podid := podmanTest.CreatePod("") + _, ec, podid := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podid) @@ -409,7 +409,7 @@ var _ = Describe("Podman ps", func() { It("podman --pod with a non-empty pod name", func() { podName := "testPodName" - _, ec, podid := podmanTest.CreatePod(podName) + _, ec, podid := podmanTest.CreatePod(map[string][]string{"--name": {podName}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("", podName) diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index 584ccd22b..bfe9563ea 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -197,10 +197,10 @@ var _ = Describe("Podman restart", func() { Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1]))) }) - It("Podman restart a container in a pod and hosts shouln't duplicated", func() { + It("Podman restart a container in a pod and hosts should not duplicated", func() { // Fixes: https://github.com/containers/podman/issues/8921 - _, ec, _ := podmanTest.CreatePod("foobar99") + _, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"foobar99"}}) Expect(ec).To(Equal(0)) session := podmanTest.RunTopContainerInPod("host-restart-test", "foobar99") @@ -225,4 +225,26 @@ var _ = Describe("Podman restart", func() { // line count should be equal Expect(beforeRestart.OutputToString()).To(Equal(afterRestart.OutputToString())) }) + + It("podman restart --all", func() { + session := podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + + session = podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) + + session = podmanTest.Podman([]string{"stop", "--all"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + + session = podmanTest.Podman([]string{"restart", "--all"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) + }) }) diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index ebea2132a..676f24e5d 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -376,6 +376,13 @@ var _ = Describe("Podman run networking", func() { Expect(session.ExitCode()).To(Equal(0)) }) + It("podman run slirp4netns network with mtu", func() { + session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:mtu=9000", ALPINE, "ip", "addr"}) + session.Wait(30) + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring("mtu 9000")) + }) + It("podman run slirp4netns network with different cidr", func() { slirp4netnsHelp := SystemExec("slirp4netns", []string{"--help"}) Expect(slirp4netnsHelp.ExitCode()).To(Equal(0)) diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index 7c74cea78..bc89b59de 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -110,7 +110,7 @@ var _ = Describe("Podman run with volumes", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring(dest + " ro")) - session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",shared", ALPINE, "grep", dest, "/proc/self/mountinfo"}) + session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",consistency=delegated,shared", ALPINE, "grep", dest, "/proc/self/mountinfo"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) found, matches := session.GrepString(dest) diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index c25709a63..750d38ffb 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -164,13 +164,14 @@ var _ = Describe("Podman stop", func() { }) It("podman stop container --timeout", func() { - session := podmanTest.RunTopContainer("test5") + session := podmanTest.Podman([]string{"run", "-d", "--name", "test5", ALPINE, "sleep", "100"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) cid1 := session.OutputToString() - session = podmanTest.Podman([]string{"stop", "--timeout", "1", "test5"}) - session.WaitWithDefaultTimeout() + // Without timeout container stops in 10 seconds + // If not stopped in 5 seconds, then --timeout did not work + session.Wait(5) Expect(session.ExitCode()).To(Equal(0)) output := session.OutputToString() Expect(output).To(ContainSubstring(cid1)) @@ -307,4 +308,38 @@ var _ = Describe("Podman stop", func() { result.WaitWithDefaultTimeout() Expect(result.ExitCode()).To(Equal(125)) }) + + It("podman stop --all", func() { + session := podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + + session = podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) + + session = podmanTest.Podman([]string{"stop", "--all"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) + + It("podman stop --ignore", func() { + session := podmanTest.RunTopContainer("") + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid := session.OutputToString() + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + + session = podmanTest.Podman([]string{"stop", "bogus", cid}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + + session = podmanTest.Podman([]string{"stop", "--ignore", "bogus", cid}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) }) diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go index aa8a1f245..4f1e74977 100644 --- a/test/e2e/wait_test.go +++ b/test/e2e/wait_test.go @@ -34,7 +34,7 @@ var _ = Describe("Podman wait", func() { It("podman wait on bogus container", func() { session := podmanTest.Podman([]string{"wait", "1234"}) - session.Wait() + session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) }) @@ -45,7 +45,7 @@ var _ = Describe("Podman wait", func() { cid := session.OutputToString() Expect(session.ExitCode()).To(Equal(0)) session = podmanTest.Podman([]string{"wait", cid}) - session.Wait() + session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) }) |