diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-11-03 13:15:16 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2020-11-09 10:45:54 -0700 |
commit | 2d50ec69965af3e5e15922094294fd451d468c46 (patch) | |
tree | da57246e1e28a8b2bf0b503488495ab7fd693a67 /test/python/docker/test_system.py | |
parent | e2b82e6245ed9459a37dc004a2b1d593d2835cb7 (diff) | |
download | podman-2d50ec69965af3e5e15922094294fd451d468c46.tar.gz podman-2d50ec69965af3e5e15922094294fd451d468c46.tar.bz2 podman-2d50ec69965af3e5e15922094294fd451d468c46.zip |
Update CI tests to run python docker library against API
* Update reference to docker-py to docker to reflect change in library
name
* Update tests to create storage sandbox
* Enable all tests that endpoints support
* Refactor containers/{id}/rename to return 404 not 500
* Refactor tests to use quay.io vs. docker.io
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test/python/docker/test_system.py')
-rw-r--r-- | test/python/docker/test_system.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/python/docker/test_system.py b/test/python/docker/test_system.py new file mode 100644 index 000000000..f911baee4 --- /dev/null +++ b/test/python/docker/test_system.py @@ -0,0 +1,66 @@ +import subprocess +import sys +import time +import unittest + +from docker import APIClient + +from test.python.docker import Podman, common, constant + + +class TestSystem(unittest.TestCase): + podman = None # initialized podman configuration for tests + service = None # podman service instance + topContainerId = "" + + def setUp(self): + super().setUp() + self.client = APIClient(base_url="tcp://127.0.0.1:8080", timeout=15) + + TestSystem.podman.restore_image_from_cache(self.client) + TestSystem.topContainerId = common.run_top_container(self.client) + + def tearDown(self): + common.remove_all_containers(self.client) + common.remove_all_images(self.client) + self.client.close() + return super().tearDown() + + @classmethod + def setUpClass(cls): + super().setUpClass() + TestSystem.podman = Podman() + TestSystem.service = TestSystem.podman.open( + "system", "service", "tcp:127.0.0.1:8080", "--time=0" + ) + # give the service some time to be ready... + time.sleep(2) + + returncode = TestSystem.service.poll() + if returncode is not None: + raise subprocess.CalledProcessError(returncode, "podman system service") + + @classmethod + def tearDownClass(cls): + TestSystem.service.terminate() + stdout, stderr = TestSystem.service.communicate(timeout=0.5) + if stdout: + sys.stdout.write("\nImages Service Stdout:\n" + stdout.decode("utf-8")) + if stderr: + sys.stderr.write("\nImAges Service Stderr:\n" + stderr.decode("utf-8")) + + TestSystem.podman.tear_down() + return super().tearDownClass() + + def test_Info(self): + self.assertIsNotNone(self.client.info()) + + def test_info_container_details(self): + info = self.client.info() + self.assertEqual(info["Containers"], 1) + self.client.create_container(image=constant.ALPINE) + info = self.client.info() + self.assertEqual(info["Containers"], 2) + + def test_version(self): + self.assertIsNotNone(self.client.version()) |