Merge "remove default value of repeat-actions"

This commit is contained in:
Jenkins 2016-03-14 10:50:12 +00:00 committed by Gerrit Code Review
commit 844bf19be0
3 changed files with 31 additions and 1 deletions

View File

@ -266,3 +266,22 @@ class ShellEndpointTest(ShellTestBase):
self._test_endpoint_and_token('--os-auth-token', '--os-endpoint')
self._test_endpoint_and_token('--os-token', '--ceilometer-url')
self._test_endpoint_and_token('--os-token', '--os-endpoint')
class ShellAlarmUpdateRepeatAction(ShellTestBase):
@mock.patch('ceilometerclient.v2.alarms.AlarmManager.update')
@mock.patch('ceilometerclient.v2.client.Client._get_alarm_client',
mock.Mock())
def test_repeat_action_not_specified(self, mocked):
self.make_env(FAKE_V2_ENV)
def _test(method):
args = ['--debug', method, '--state', 'alarm', '123']
ceilometer_shell.main(args)
args, kwargs = mocked.call_args
self.assertEqual(None, kwargs.get('repeat_actions'))
_test('alarm-update')
_test('alarm-threshold-update')
_test('alarm-combination-update')
_test('alarm-event-update')

View File

@ -266,6 +266,18 @@ class ShellAlarmCommandTest(utils.BaseTestCase):
method = ceilometer_shell.do_alarm_threshold_update
self._do_test_alarm_update_repeat_actions(method, False)
def test_alarm_event_upadte_repeat_action_untouched(self):
method = ceilometer_shell.do_alarm_event_update
self._do_test_alarm_update_repeat_actions(method, None)
def test_alarm_event_upadte_repeat_action_set(self):
method = ceilometer_shell.do_alarm_event_update
self._do_test_alarm_update_repeat_actions(method, True)
def test_alarm_event_upadte_repeat_action_clear(self):
method = ceilometer_shell.do_alarm_event_update
self._do_test_alarm_update_repeat_actions(method, False)
@mock.patch('sys.stdout', new=six.StringIO())
def test_alarm_threshold_create_args(self):
argv = ['alarm-threshold-create'] + self.THRESHOLD_ALARM_CLI_ARGS

View File

@ -503,7 +503,6 @@ def common_alarm_arguments(create=False):
'[timezone=<IANA Timezone>]]'))
@utils.arg('--repeat-actions', dest='repeat_actions',
metavar='{True|False}', type=strutils.bool_from_string,
default=False,
help=('True if actions should be repeatedly notified '
'while alarm remains in target state.'))
@functools.wraps(func)