aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEduardo Gonzalez <dabarren@gmail.com>2017-08-30 17:38:36 +0200
committerEduardo Gonzalez <dabarren@gmail.com>2018-01-26 07:30:11 +0000
commit448a10df6cbd53bc93d7b767787ef925169bc3d4 (patch)
tree5b21ca6e8e70f850cffbfcde21cd39647c393cb6 /tests
parent02fa35dc8ebc7da8e115c61bf90aacd30cff8b30 (diff)
downloadkolla-ansible-448a10df6cbd53bc93d7b767787ef925169bc3d4.tar.gz
kolla-ansible-448a10df6cbd53bc93d7b767787ef925169bc3d4.zip
Add container state check in kolla_docker
Missing container status check in recreate_or_restart_container, this causes if the container is not running (kolla-ansible stop), to not be started with deploy/reconfigure/upgrade if any other param changes. Change-Id: I5cff5f367e963ba8b1807ec46469da817e40e468 Closes-Bug: #1714015
Diffstat (limited to 'tests')
-rw-r--r--tests/test_kolla_docker.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_kolla_docker.py b/tests/test_kolla_docker.py
index 578a3ef3e..4179f9cb3 100644
--- a/tests/test_kolla_docker.py
+++ b/tests/test_kolla_docker.py
@@ -71,6 +71,10 @@ class ModuleArgsTest(base.BaseTestCase):
'always',
'unless-stopped']),
restart_retries=dict(required=False, type='int', default=10),
+ state=dict(required=False, type='str', default='running',
+ choices=['running',
+ 'exited',
+ 'paused']),
tls_verify=dict(required=False, type='bool', default=False),
tls_cert=dict(required=False, type='str'),
tls_key=dict(required=False, type='str'),
@@ -772,3 +776,13 @@ class TestAttrComp(base.BaseTestCase):
KOLLA_INSTALL_TYPE='binary')})
self.assertTrue(self.dw.compare_environment(container_info))
+
+ def test_compare_container_state_neg(self):
+ container_info = {'State': dict(Status='running')}
+ self.dw = get_DockerWorker({'state': 'running'})
+ self.assertFalse(self.dw.compare_container_state(container_info))
+
+ def test_compare_container_state_pos(self):
+ container_info = {'State': dict(Status='running')}
+ self.dw = get_DockerWorker({'state': 'exited'})
+ self.assertTrue(self.dw.compare_container_state(container_info))