aboutsummaryrefslogtreecommitdiff
path: root/test/e2e/pod_clone_test.go
diff options
context:
space:
mode:
authorcdoern <cdoern@redhat.com>2022-06-06 13:03:37 -0400
committerCharlie Doern <cdoern@redhat.com>2022-07-05 09:28:07 -0400
commit8f2d9e7a7c30f5e74f6aa0375b21a4522ec81756 (patch)
tree03526a91d8d8c428547b63b22f145e59a373bd63 /test/e2e/pod_clone_test.go
parent13479d457d34496b43027bc1d71cdb0891a8b738 (diff)
downloadpodman-8f2d9e7a7c30f5e74f6aa0375b21a4522ec81756.tar.gz
podman-8f2d9e7a7c30f5e74f6aa0375b21a4522ec81756.tar.bz2
podman-8f2d9e7a7c30f5e74f6aa0375b21a4522ec81756.zip
podman pod create --uts support
add support for the --uts flag in pod create, allowing users to avoid issues with default values in containers.conf. uts follows the same format as other namespace flags: --uts=private (default), --uts=host, --uts=ns:PATH resolves #13714 Signed-off-by: Charlie Doern <cdoern@redhat.com>
Diffstat (limited to 'test/e2e/pod_clone_test.go')
-rw-r--r--test/e2e/pod_clone_test.go42
1 files changed, 39 insertions, 3 deletions
diff --git a/test/e2e/pod_clone_test.go b/test/e2e/pod_clone_test.go
index b90bf10da..0a1d2358c 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 create --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))
+ })
+
})