summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/cp_test.go36
-rw-r--r--test/e2e/port_test.go38
2 files changed, 74 insertions, 0 deletions
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index 5e98e73eb..edd9c70c6 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -209,4 +209,40 @@ var _ = Describe("Podman cp", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
+
+ It("podman cp from ctr chown ", func() {
+ setup := podmanTest.RunTopContainer("testctr")
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"exec", "testctr", "adduser", "-S", "testuser"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"exec", "-u", "testuser", "testctr", "touch", "testfile"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"cp", "testctr:testfile", "testfile1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // owner of the file copied to local machine is not testuser
+ cmd := exec.Command("ls", "-l", "testfile1")
+ cmdRet, err := cmd.Output()
+ Expect(err).To(BeNil())
+ Expect(strings.Contains(string(cmdRet), "testuser")).To(BeFalse())
+
+ session = podmanTest.Podman([]string{"cp", "testfile1", "testctr:testfile2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // owner of the file copied to a container is the root user
+ session = podmanTest.Podman([]string{"exec", "-it", "testctr", "ls", "-l", "testfile2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(ContainSubstring("root"))
+
+ os.Remove("testfile1")
+ })
})
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index 26c5fd7d0..b15d8e133 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -105,4 +105,42 @@ var _ = Describe("Podman port", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
+
+ It("podman port nginx by name", func() {
+ session, cid := podmanTest.RunNginxWithHealthCheck("portcheck")
+ Expect(session.ExitCode()).To(Equal(0))
+
+ if err := podmanTest.RunHealthCheck(cid); err != nil {
+ Fail(err.Error())
+ }
+
+ result := podmanTest.Podman([]string{"port", "portcheck"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ result.LineInOuputStartsWith("80/tcp -> 0.0.0.0:")
+ })
+
+ It("podman port multiple ports", func() {
+ // Acquire and release locks
+ lock1 := GetPortLock("5000")
+ defer lock1.Unlock()
+ lock2 := GetPortLock("5001")
+ defer lock2.Unlock()
+
+ setup := podmanTest.Podman([]string{"run", "-dt", "-p", "5000:5000", "-p", "5001:5001", ALPINE, "top"})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(BeZero())
+
+ // Check that the first port was honored
+ result1 := podmanTest.Podman([]string{"port", "-l", "5000"})
+ result1.WaitWithDefaultTimeout()
+ Expect(result1.ExitCode()).To(BeZero())
+ Expect(result1.LineInOuputStartsWith("0.0.0.0:5000"))
+
+ // Check that the second port was honored
+ result2 := podmanTest.Podman([]string{"port", "-l", "5001"})
+ result2.WaitWithDefaultTimeout()
+ Expect(result2.ExitCode()).To(BeZero())
+ Expect(result2.LineInOuputStartsWith("0.0.0.0:5001"))
+ })
})