summaryrefslogtreecommitdiff
path: root/contrib/python/podman/test/test_pods_ctnrs.py
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2018-09-25 10:09:16 -0700
committerJhon Honce <jhonce@redhat.com>2018-10-01 07:24:50 -0700
commit9074565f4e623124f17ce02657e35d658abafae5 (patch)
tree6177fa9a72650f6d5ce4cdc2dca0b86dc17c69cd /contrib/python/podman/test/test_pods_ctnrs.py
parentdf978a264d7944351e7cded0a9506cab8a7bb0db (diff)
downloadpodman-9074565f4e623124f17ce02657e35d658abafae5.tar.gz
podman-9074565f4e623124f17ce02657e35d658abafae5.tar.bz2
podman-9074565f4e623124f17ce02657e35d658abafae5.zip
Implement pod varlink bindings
* Update varlink document * Add NoContainersInPod error in go and python * Add support for varlink pod interface * New code passes pylint * Fix bug in test_runner.sh * Update integration tests for race condition on status check * Add missing port config file support Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'contrib/python/podman/test/test_pods_ctnrs.py')
-rw-r--r--contrib/python/podman/test/test_pods_ctnrs.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/contrib/python/podman/test/test_pods_ctnrs.py b/contrib/python/podman/test/test_pods_ctnrs.py
new file mode 100644
index 000000000..c5733091c
--- /dev/null
+++ b/contrib/python/podman/test/test_pods_ctnrs.py
@@ -0,0 +1,65 @@
+import os
+from test.podman_testcase import PodmanTestCase
+
+import podman
+from podman import FoldedString
+
+pod = None
+
+
+class TestPodsCtnrs(PodmanTestCase):
+ @classmethod
+ def setUpClass(cls):
+ # Populate storage
+ super().setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ super().tearDownClass()
+
+ def setUp(self):
+ self.tmpdir = os.environ['TMPDIR']
+ self.host = os.environ['PODMAN_HOST']
+
+ self.pclient = podman.Client(self.host)
+
+ def test_010_populate(self):
+ global pod
+
+ pod = self.pclient.pods.create('pod1')
+ self.assertEqual('pod1', pod.name)
+
+ img = self.pclient.images.get('docker.io/library/alpine:latest')
+ ctnr = img.container(pod=pod.id)
+
+ pod.refresh()
+ self.assertEqual('1', pod.numberofcontainers)
+ self.assertEqual(ctnr.id, pod.containersinfo[0]['id'])
+
+ def test_015_one_shot(self):
+ global pod
+
+ details = pod.inspect()
+ state = FoldedString(details.containers[0]['state'])
+ self.assertEqual(state, 'configured')
+
+ pod = pod.start()
+ status = FoldedString(pod.containersinfo[0]['status'])
+ # Race on whether container is still running or finished
+ self.assertIn(status, ('exited', 'running'))
+
+ pod = pod.restart()
+ status = FoldedString(pod.containersinfo[0]['status'])
+ self.assertIn(status, ('exited', 'running'))
+
+ killed = pod.kill()
+ self.assertEqual(pod, killed)
+
+ def test_999_remove(self):
+ global pod
+
+ ident = pod.remove(force=True)
+ self.assertEqual(ident, pod.id)
+
+ with self.assertRaises(StopIteration):
+ next(self.pclient.pods.list())