diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/rest_api/test_rest_v2_0_0.py | 14 | ||||
-rw-r--r-- | test/e2e/play_kube_test.go | 15 | ||||
-rw-r--r-- | test/e2e/pod_inspect_test.go | 19 | ||||
-rw-r--r-- | test/e2e/pod_pod_namespaces_test.go (renamed from test/e2e/pod_pod_namespaces.go) | 0 | ||||
-rw-r--r-- | test/e2e/ps_test.go | 122 | ||||
-rw-r--r-- | test/e2e/run_seccomp_test.go (renamed from test/e2e/run_seccomp.go) | 0 | ||||
-rw-r--r-- | test/e2e/run_security_labels_test.go (renamed from test/e2e/run_security_labels.go) | 0 | ||||
-rw-r--r-- | test/e2e/run_working_dir_test.go (renamed from test/e2e/run_working_dir.go) | 0 | ||||
-rw-r--r-- | test/e2e/search_test.go | 4 | ||||
-rw-r--r-- | test/python/docker/test_containers.py | 10 |
10 files changed, 173 insertions, 11 deletions
diff --git a/test/apiv2/rest_api/test_rest_v2_0_0.py b/test/apiv2/rest_api/test_rest_v2_0_0.py index 7192347c7..49e18f063 100644 --- a/test/apiv2/rest_api/test_rest_v2_0_0.py +++ b/test/apiv2/rest_api/test_rest_v2_0_0.py @@ -187,12 +187,14 @@ class TestApi(unittest.TestCase): payload = json.loads(create.text) self.assertIsNotNone(payload["Id"]) - connect = requests.post( - PODMAN_URL + "/v1.40/networks/TestNetwork/connect", - json={"Container": payload["Id"]}, - ) - self.assertEqual(connect.status_code, 200, create.text) - self.assertEqual(connect.text, "OK\n") + # This cannot be done until full completion of the network connect + # stack and network disconnect stack are complete + # connect = requests.post( + # PODMAN_URL + "/v1.40/networks/TestNetwork/connect", + # json={"Container": payload["Id"]}, + # ) + # self.assertEqual(connect.status_code, 200, connect.text) + # self.assertEqual(connect.text, "OK\n") def test_commit(self): r = requests.post(_url(ctnr("/commit?container={}"))) diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 7ae474c76..92e4544f9 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1482,4 +1482,19 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) Expect(inspect.ExitCode()).To(Equal(0)) Expect(inspect.OutputToString()).To(ContainSubstring("journald")) }) + + It("podman play kube test only creating the containers", func() { + pod := getPod() + err := generateKubeYaml("pod", pod, kubeYaml) + Expect(err).To(BeNil()) + + kube := podmanTest.Podman([]string{"play", "kube", "--start=false", kubeYaml}) + kube.WaitWithDefaultTimeout() + Expect(kube.ExitCode()).To(Equal(0)) + + inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ .State.Running }}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect.OutputToString()).To(Equal("false")) + }) }) diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index ccdf0a423..25212991d 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -99,4 +99,23 @@ var _ = Describe("Podman pod inspect", func() { Expect(len(inspectJSON.InfraConfig.PortBindings["80/tcp"])).To(Equal(1)) Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0].HostPort).To(Equal("8080")) }) + + It("podman pod inspect outputs show correct MAC", func() { + SkipIfRootless("--mac-address is not supported in rootless mode") + podName := "testPod" + macAddr := "42:43:44:00:00:01" + create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--mac-address", macAddr}) + create.WaitWithDefaultTimeout() + Expect(create.ExitCode()).To(Equal(0)) + + create = podmanTest.Podman([]string{"run", "-d", "--pod", podName, ALPINE, "top"}) + create.WaitWithDefaultTimeout() + Expect(create.ExitCode()).To(Equal(0)) + + inspectOut := podmanTest.Podman([]string{"pod", "inspect", podName}) + inspectOut.WaitWithDefaultTimeout() + Expect(inspectOut.ExitCode()).To(Equal(0)) + + Expect(inspectOut.OutputToString()).To(ContainSubstring(macAddr)) + }) }) diff --git a/test/e2e/pod_pod_namespaces.go b/test/e2e/pod_pod_namespaces_test.go index 20b8bdb39..20b8bdb39 100644 --- a/test/e2e/pod_pod_namespaces.go +++ b/test/e2e/pod_pod_namespaces_test.go diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index f3a66e58a..fd08d4308 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -545,4 +545,126 @@ var _ = Describe("Podman ps", func() { Expect(result.ExitCode()).To(Equal(0)) Expect(result.OutputToString()).To(ContainSubstring("ago")) }) + + It("podman ps filter test", func() { + session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", "--label", "foo=1", + "--label", "bar=2", "--volume", "volume1:/test", ALPINE, "top"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + cid1 := session.OutputToString() + + session = podmanTest.Podman([]string{"run", "--name", "test2", "--label", "foo=1", + ALPINE, "ls", "/fail"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(1)) + + session = podmanTest.Podman([]string{"create", "--name", "test3", ALPINE, cid1}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"run", "--name", "test4", "--volume", "volume1:/test1", + "--volume", "/:/test2", ALPINE, "ls"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(5)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + Expect(session.LineInOutputContains("test3")).To(BeTrue()) + Expect(session.LineInOutputContains("test4")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "name=test1", "--filter", "name=test2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + + // check container id matches with regex + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "id=" + cid1[:40], "--filter", "id=" + cid1 + "$"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--filter", "status=created"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test3")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--filter", "status=created", "--filter", "status=exited"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(4)) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + Expect(session.LineInOutputContains("test3")).To(BeTrue()) + Expect(session.LineInOutputContains("test4")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--filter", "label=foo=1", "--filter", "status=exited"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=non=1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(1)) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "label=foo=1", "--filter", "label=bar=2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "exited=1", "--filter", "exited=0"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + Expect(session.LineInOutputContains("test2")).To(BeTrue()) + Expect(session.LineInOutputContains("test4")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=volume1"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + Expect(session.LineInOutputContains("test4")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "volume=/:/test2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test4")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "before=test2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(2)) + Expect(session.LineInOutputContains("test1")).To(BeTrue()) + + session = podmanTest.Podman([]string{"ps", "--all", "--filter", "since=test2"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(len(session.OutputToStringArray())).To(Equal(3)) + Expect(session.LineInOutputContains("test3")).To(BeTrue()) + Expect(session.LineInOutputContains("test4")).To(BeTrue()) + }) }) diff --git a/test/e2e/run_seccomp.go b/test/e2e/run_seccomp_test.go index 7d04cc60a..7d04cc60a 100644 --- a/test/e2e/run_seccomp.go +++ b/test/e2e/run_seccomp_test.go diff --git a/test/e2e/run_security_labels.go b/test/e2e/run_security_labels_test.go index 0c5621e3f..0c5621e3f 100644 --- a/test/e2e/run_security_labels.go +++ b/test/e2e/run_security_labels_test.go diff --git a/test/e2e/run_working_dir.go b/test/e2e/run_working_dir_test.go index 7d8db361c..7d8db361c 100644 --- a/test/e2e/run_working_dir.go +++ b/test/e2e/run_working_dir_test.go diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 7747cdd0e..5c3c69fd4 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -93,10 +93,10 @@ registries = ['{{.Host}}:{{.Port}}']` }) It("podman search single registry flag", func() { - search := podmanTest.Podman([]string{"search", "quay.io/libpod/gate:latest"}) + search := podmanTest.Podman([]string{"search", "quay.io/skopeo/stable:latest"}) search.WaitWithDefaultTimeout() Expect(search.ExitCode()).To(Equal(0)) - Expect(search.LineInOutputContains("quay.io/libpod/gate")).To(BeTrue()) + Expect(search.LineInOutputContains("quay.io/skopeo/stable")).To(BeTrue()) }) It("podman search image with description", func() { diff --git a/test/python/docker/test_containers.py b/test/python/docker/test_containers.py index 5fb340fd4..0fd419d9d 100644 --- a/test/python/docker/test_containers.py +++ b/test/python/docker/test_containers.py @@ -60,10 +60,14 @@ class TestContainers(unittest.TestCase): def test_create_network(self): net = self.client.networks.create("testNetwork", driver="bridge") ctnr = self.client.containers.create(image="alpine", detach=True) - net.connect(ctnr) - nets = self.client.networks.list(greedy=True) - self.assertGreaterEqual(len(nets), 1) + # TODO fix when ready + # This test will not work until all connect|disconnect + # code is fixed. + # net.connect(ctnr) + + # nets = self.client.networks.list(greedy=True) + # self.assertGreaterEqual(len(nets), 1) # TODO fix endpoint to include containers # for n in nets: |