Have change_alarm_state return success or failure

And actually check it in smoke.py

Change-Id: I888bca006b5c0e82dd11601a2e5824579fad1048
This commit is contained in:
Craig Bryant 2014-11-04 13:24:29 -07:00
parent ff8d05780a
commit 2ae8b2bbef
2 changed files with 6 additions and 2 deletions

View File

@ -71,7 +71,8 @@ def change_alarm_state(alarm_id, new_state):
if result_json['state'] != new_state: if result_json['state'] != new_state:
print('Alarm patch failed, expected state of %s but was %s' % print('Alarm patch failed, expected state of %s but was %s' %
(result_json['state'], new_state), file=sys.stderr) (result_json['state'], new_state), file=sys.stderr)
return 1 return False
return True
def find_alarms_for_definition(alarm_definition_id): def find_alarms_for_definition(alarm_definition_id):

View File

@ -207,7 +207,10 @@ def smoke_test(mail_host, metric_host):
new_state = 'OK' new_state = 'OK'
states.append(new_state) states.append(new_state)
cli_wrapper.change_alarm_state(alarm_id, new_state) if not cli_wrapper.change_alarm_state(alarm_id, new_state):
print('Unabled to change Alarm state', file=sys.stderr)
return False
# There is a bug in the API which allows this to work. Soon that # There is a bug in the API which allows this to work. Soon that
# will be fixed and this will fail # will be fixed and this will fail
if len(sys.argv) > 1: if len(sys.argv) > 1: