summaryrefslogtreecommitdiff
path: root/heatclient/tests
diff options
context:
space:
mode:
authorPavlo Shchelokovskyy <shchelokovskyy@gmail.com>2019-01-25 11:47:31 +0200
committerPavlo Shchelokovskyy <pshchelokovskyy@mirantis.com>2019-09-25 08:57:33 +0000
commit033511c291c811f9368aaccdc81de3c9c93c9ae2 (patch)
tree068e68dbbea9ec8ed89d6e90274b55fffa3c60a5 /heatclient/tests
parent4d8f270157bf2e56ede62c61985c8fad41daceb7 (diff)
downloadpython-heatclient-033511c291c811f9368aaccdc81de3c9c93c9ae2.tar.gz
Allow to set poll interval to OSC stack create
In certain scenarios the default poll interval of 5s used by `openstack stack create --wait` command is too short. Setting the poll interval was supported in heat CLI with `heat stack-create --poll N` but is missing in OSC plugin. This patch adds an optional argument `--poll N` (N defaults to 5) to the `openstack stack create` command. Change-Id: Id279d92ea890032f280e453b795ede2818ffbb8c Story: 2004863 Task: 29106
Diffstat (limited to 'heatclient/tests')
-rw-r--r--heatclient/tests/unit/osc/v1/test_stack.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py
index 146c1bc..d6a51b0 100644
--- a/heatclient/tests/unit/osc/v1/test_stack.py
+++ b/heatclient/tests/unit/osc/v1/test_stack.py
@@ -148,6 +148,24 @@ class TestStackCreate(TestStack):
self.cmd.take_action(parsed_args)
+ mock_poll.assert_called_once_with(mock.ANY, 'my_stack',
+ action='CREATE', poll_period=5)
+ self.stack_client.create.assert_called_with(**self.defaults)
+ self.stack_client.get.assert_called_with(**{'stack_id': '1234',
+ 'resolve_outputs': False})
+
+ @mock.patch('heatclient.common.event_utils.poll_for_events',
+ return_value=('CREATE_COMPLETE',
+ 'Stack my_stack CREATE_COMPLETE'))
+ def test_stack_create_wait_with_poll(self, mock_poll):
+ arglist = ['my_stack', '-t', self.template_path, '--wait',
+ '--poll', '10']
+ parsed_args = self.check_parser(self.cmd, arglist, [])
+
+ self.cmd.take_action(parsed_args)
+
+ mock_poll.assert_called_once_with(mock.ANY, 'my_stack',
+ action='CREATE', poll_period=10)
self.stack_client.create.assert_called_with(**self.defaults)
self.stack_client.get.assert_called_with(**{'stack_id': '1234',
'resolve_outputs': False})