From 07e391ee17bb78ed20f3ca7b412ad883f306b9b2 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Wed, 8 Mar 2017 10:26:01 -0600 Subject: [PATCH] Handle the case that the time is zero If a container is created but not started yet, the "StartedAt" field of the Docker container will be January 1, year 1, 00:00:00 UTC. This commit will check for this case and print "Created" to the status_detail field. Depends-On: I6185e3b8fc5e5b132656ff416e08917edd938fc8 Change-Id: If3eca41e52f32dddb9cbc34d64fdc931e1d219e6 --- zun_tempest_plugin/tests/tempest/api/test_containers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zun_tempest_plugin/tests/tempest/api/test_containers.py b/zun_tempest_plugin/tests/tempest/api/test_containers.py index bd06576..ba431a0 100644 --- a/zun_tempest_plugin/tests/tempest/api/test_containers.py +++ b/zun_tempest_plugin/tests/tempest/api/test_containers.py @@ -182,13 +182,13 @@ class TestContainer(base.BaseZunTest): self.assertEqual(202, resp.status) # Wait for container to finish creation self.container_client.ensure_container_in_desired_state( - model.uuid, 'Stopped') + model.uuid, 'Created') # Assert the container is created resp, model = self.container_client.get_container(model.uuid) self.assertEqual(200, resp.status) - self.assertEqual('Stopped', model.status) - self.assertEqual('Stopped', self._get_container_state(model.uuid)) + self.assertEqual('Created', model.status) + self.assertEqual('Created', self._get_container_state(model.uuid)) return resp, model def _run_container(self, **kwargs): @@ -220,5 +220,7 @@ class TestContainer(base.BaseZunTest): return 'Paused' elif status.get('Running'): return 'Running' + elif status.get('Status') == 'created': + return 'Created' else: return 'Stopped'