diff options
author | huangtianhua <huangtianhua@huawei.com> | 2015-07-09 09:15:10 +0800 |
---|---|---|
committer | huangtianhua <huangtianhua@huawei.com> | 2015-09-09 14:52:37 +0800 |
commit | 18ded430d0e256ce5f9eec3ef61b5337596f914a (patch) | |
tree | 764364609a80d62b7fe79fb905a953b7ef2d63e7 /heat_integrationtests | |
parent | f1cfb9ed39a6316f4da2148e7830874b59b56863 (diff) | |
download | heat-18ded430d0e256ce5f9eec3ef61b5337596f914a.tar.gz |
Return error message if validate fail when clearing hook
There are some situations:
1. User can run the command "heat hook-clear" on any
resource in the stack, even if there is no hook
defined on it, and no error or warning message is returned.
2. User run the command "heat hook-clear" on resource
to clear the hook which resource unset, and no error or
warning message is returned.
3. User run the command "heat hook-clear" on resource
even if the resource's action is not support to signal, and
no error or warning message is returned.
4. User run the command "heat hook-clear" to clear invalid
hooks, and no error or warnning message is returned.
This patch will check the situations above before call
resource.signal, and will return error messages to user.
Change-Id: Ifb9befad864ebe1bb5f8b419b95d1b3a95530573
Closes-Bug: #1472515
Diffstat (limited to 'heat_integrationtests')
-rw-r--r-- | heat_integrationtests/functional/test_autoscaling.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/heat_integrationtests/functional/test_autoscaling.py b/heat_integrationtests/functional/test_autoscaling.py index 1b9fe991b..90414051d 100644 --- a/heat_integrationtests/functional/test_autoscaling.py +++ b/heat_integrationtests/functional/test_autoscaling.py @@ -13,7 +13,9 @@ import copy import json +from heatclient import exc from oslo_log import log as logging +import six from testtools import matchers from heat_integrationtests.common import test @@ -728,8 +730,13 @@ outputs: self._wait_for_resource_status( stack_identifier, 'JobServerGroup', 'SUSPEND_COMPLETE') - # Send a signal and confirm nothing happened. - self.client.resources.signal(stack_identifier, 'ScaleUpPolicy') + # Send a signal and a exception will raise + ex = self.assertRaises(exc.BadRequest, + self.client.resources.signal, + stack_identifier, 'ScaleUpPolicy') + + error_msg = 'Signal resource during SUSPEND is not supported' + self.assertIn(error_msg, six.text_type(ex)) ev = self.wait_for_event_with_reason( stack_identifier, reason='Cannot signal resource during SUSPEND', |