diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-09-25 10:09:16 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2018-10-01 07:24:50 -0700 |
commit | 9074565f4e623124f17ce02657e35d658abafae5 (patch) | |
tree | 6177fa9a72650f6d5ce4cdc2dca0b86dc17c69cd /contrib/python/podman/test/test_pods_no_ctnrs.py | |
parent | df978a264d7944351e7cded0a9506cab8a7bb0db (diff) | |
download | podman-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_no_ctnrs.py')
-rw-r--r-- | contrib/python/podman/test/test_pods_no_ctnrs.py | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/contrib/python/podman/test/test_pods_no_ctnrs.py b/contrib/python/podman/test/test_pods_no_ctnrs.py new file mode 100644 index 000000000..48b4f74e4 --- /dev/null +++ b/contrib/python/podman/test/test_pods_no_ctnrs.py @@ -0,0 +1,94 @@ +import os +import unittest + +import podman +import varlink + +ident = None +pod = None + + +class TestPodsNoCtnrs(unittest.TestCase): + def setUp(self): + self.tmpdir = os.environ['TMPDIR'] + self.host = os.environ['PODMAN_HOST'] + + self.pclient = podman.Client(self.host) + + def test_010_create(self): + global ident + + actual = self.pclient.pods.create('pod0') + self.assertIsNotNone(actual) + ident = actual.id + + def test_015_list(self): + global ident, pod + + actual = next(self.pclient.pods.list()) + self.assertEqual('pod0', actual.name) + self.assertEqual(ident, actual.id) + self.assertEqual('Created', actual.status) + self.assertEqual('0', actual.numberofcontainers) + self.assertFalse(actual.containersinfo) + pod = actual + + def test_020_get(self): + global ident, pod + + actual = self.pclient.pods.get(pod.id) + self.assertEqual('pod0', actual.name) + self.assertEqual(ident, actual.id) + self.assertEqual('Created', actual.status) + self.assertEqual('0', actual.numberofcontainers) + self.assertFalse(actual.containersinfo) + + def test_025_inspect(self): + global ident, pod + + details = pod.inspect() + self.assertEqual(ident, details.id) + self.assertEqual('pod0', details.config['name']) + self.assertIsNone(details.containers) + + def test_030_ident_no_ctnrs(self): + global ident, pod + + actual = pod.kill() + self.assertEqual(pod, actual) + + actual = pod.pause() + self.assertEqual(pod, actual) + + actual = pod.unpause() + self.assertEqual(pod, actual) + + actual = pod.stop() + self.assertEqual(pod, actual) + + def test_045_raises_no_ctnrs(self): + global ident, pod + + with self.assertRaises(podman.NoContainersInPod): + pod.start() + + with self.assertRaises(podman.NoContainersInPod): + pod.restart() + + with self.assertRaises(podman.NoContainerRunning): + next(pod.stats()) + + with self.assertRaises(varlink.error.MethodNotImplemented): + pod.top() + + with self.assertRaises(varlink.error.MethodNotImplemented): + pod.wait() + + def test_999_remove(self): + global ident, pod + + actual = pod.remove() + self.assertEqual(ident, actual) + + with self.assertRaises(StopIteration): + next(self.pclient.pods.list()) |