fix create container: handle empty host port

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek committed 2021-02-16 12:24:44 +01:00
1 parent ac9a048b59
commit 714acf3267
2 files changed
+12 -1

No files matched your search

+7
View File
@@ -86,6 +86,13 @@ class TestContainers(unittest.TestCase):
containers = self.client.containers.list(all=True)
self.assertEqual(len(containers), 2)
def test_start_container_with_random_port_bind(self):
container = self.client.containers.create(image=constant.ALPINE,
name="containerWithRandomBind",
ports={'1234/tcp': None})
containers = self.client.containers.list(all=True)
self.assertTrue(container in containers)
def test_stop_container(self):
top = self.client.containers.get(TestContainers.topContainerId)
self.assertEqual(top.status, "running")