diff options
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/libpod_suite_test.go | 5 | ||||
-rw-r--r-- | test/e2e/manifest_test.go | 17 | ||||
-rw-r--r-- | test/e2e/pod_clone_test.go | 42 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 31 | ||||
-rw-r--r-- | test/e2e/prune_test.go | 5 |
5 files changed, 88 insertions, 12 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index a633bd3d7..ecb7a2278 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -76,3 +76,8 @@ func (p *PodmanTestIntegration) StopRemoteService() {} // We don't support running API service when local func (p *PodmanTestIntegration) StartRemoteService() { } + +// Just a stub for compiling with `!remote`. +func getRemoteOptions(p *PodmanTestIntegration, args []string) []string { + return nil +} diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index 2f8b47e25..1f58419a1 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -42,7 +42,6 @@ var _ = Describe("Podman manifest", func() { podmanTest.Cleanup() f := CurrentGinkgoTestDescription() processTestResult(f) - }) It("create w/o image", func() { session := podmanTest.Podman([]string{"manifest", "create", "foo"}) @@ -297,8 +296,21 @@ var _ = Describe("Podman manifest", func() { registryOptions := &podmanRegistry.Options{ Image: "docker-archive:" + imageTarPath(REGISTRY_IMAGE), } + + // registry script invokes $PODMAN; make sure we define that + // so it can use our same networking options. + opts := strings.Join(podmanTest.MakeOptions(nil, false, false), " ") + if IsRemote() { + opts = strings.Join(getRemoteOptions(podmanTest, nil), " ") + } + os.Setenv("PODMAN", podmanTest.PodmanBinary+" "+opts) registry, err := podmanRegistry.StartWithOptions(registryOptions) Expect(err).To(BeNil()) + defer func() { + err := registry.Stop() + Expect(err).To(BeNil()) + os.Unsetenv("PODMAN") + }() session := podmanTest.Podman([]string{"manifest", "create", "foo"}) session.WaitWithDefaultTimeout() @@ -327,9 +339,6 @@ var _ = Describe("Podman manifest", func() { push = podmanTest.Podman([]string{"manifest", "push", "--tls-verify=false", "--creds=podmantest:wrongpasswd", "foo", "localhost:" + registry.Port + "/credstest"}) push.WaitWithDefaultTimeout() Expect(push).To(ExitWithError()) - - err = registry.Stop() - Expect(err).To(BeNil()) }) It("push with error", func() { diff --git a/test/e2e/pod_clone_test.go b/test/e2e/pod_clone_test.go index b90bf10da..9c7abe7a8 100644 --- a/test/e2e/pod_clone_test.go +++ b/test/e2e/pod_clone_test.go @@ -11,9 +11,10 @@ import ( var _ = Describe("Podman pod clone", func() { var ( - tempdir string - err error - podmanTest *PodmanTestIntegration + tempdir string + err error + podmanTest *PodmanTestIntegration + hostname, _ = os.Hostname() ) BeforeEach(func() { @@ -155,4 +156,39 @@ var _ = Describe("Podman pod clone", func() { Expect(strings[0]).Should(ContainSubstring("size=10240k")) }) + It("podman pod clone --uts test", func() { + SkipIfRemote("hostname for the custom NS test is not as expected on the remote client") + + session := podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + session = podmanTest.Podman([]string{"pod", "clone", "--uts", "host", session.OutputToString()}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + session = podmanTest.Podman([]string{"run", "-it", "--pod", session.OutputToString(), ALPINE, "printenv", "HOSTNAME"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(ContainSubstring(hostname)) + + podName := "utsPod" + ns := "ns:/proc/self/ns/" + + session = podmanTest.Podman([]string{"pod", "create"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + // just share uts with a custom path + podCreate := podmanTest.Podman([]string{"pod", "clone", "--uts", ns, "--name", podName, session.OutputToString()}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + + podInspect := podmanTest.Podman([]string{"pod", "inspect", podName}) + podInspect.WaitWithDefaultTimeout() + Expect(podInspect).Should(Exit(0)) + podJSON := podInspect.InspectPodToJSON() + Expect(podJSON.InfraConfig).To(HaveField("UtsNS", ns)) + }) + }) diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 0e363c1fb..3caae2bd5 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -23,9 +23,10 @@ import ( var _ = Describe("Podman pod create", func() { var ( - tempdir string - err error - podmanTest *PodmanTestIntegration + tempdir string + err error + podmanTest *PodmanTestIntegration + hostname, _ = os.Hostname() ) BeforeEach(func() { @@ -1136,4 +1137,28 @@ ENTRYPOINT ["sleep","99999"] Expect(run).ShouldNot(Exit(0)) }) + It("podman pod create --uts test", func() { + session := podmanTest.Podman([]string{"pod", "create", "--uts", "host"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + session = podmanTest.Podman([]string{"run", "-it", "--pod", session.OutputToString(), ALPINE, "printenv", "HOSTNAME"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(ContainSubstring(hostname)) + + podName := "utsPod" + ns := "ns:/proc/self/ns/" + + // just share uts with a custom path + podCreate := podmanTest.Podman([]string{"pod", "create", "--uts", ns, "--name", podName, "--share", "uts"}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + + podInspect := podmanTest.Podman([]string{"pod", "inspect", podName}) + podInspect.WaitWithDefaultTimeout() + Expect(podInspect).Should(Exit(0)) + podJSON := podInspect.InspectPodToJSON() + Expect(podJSON.InfraConfig).To(HaveField("UtsNS", ns)) + }) }) diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 119c8d41e..89cc65540 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -259,11 +259,12 @@ var _ = Describe("Podman prune", func() { }) It("podman system prune networks", func() { - // About netavark network backend test. + // Create new network. session := podmanTest.Podman([]string{"network", "create", "test"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) + // Remove all unused networks. session = podmanTest.Podman([]string{"system", "prune", "-f"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) @@ -274,7 +275,7 @@ var _ = Describe("Podman prune", func() { Expect(session).Should(Exit(0)) Expect(session.OutputToStringArray()).To(HaveLen(1)) - // Remove all unused networks. + // Unused networks removed. session = podmanTest.Podman([]string{"network", "ls", "-q", "--filter", "name=^test$"}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) |