remove default value of repeat-actions
I94468ff649dd4367848c74e94a3feb08494bb223 fixes problem that ceilometeclient incorrectly reset repeat-actions when update any attribute. I53f3af447a8f814388985f6e4ab57a8ffec18a2a reverts most of the above change, which leading to bug 1539092. Because repeat-actions has default value False, no matter we set it or not, it will replace this bit when we get alarm from API. The unit test doesn't cover such case, so this change still succeeds in CI test. We don't need to revert it again, because the redundant code for create and update is not needed, repeat-actions has default value (False) in API side, so the proper way is simply removing the default value in CLI side. Change-Id: I39c28294db3e55141bb8a2024a6ddfdf8acf5e0d Closes-Bug: #1539092
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user