From 2ae8b2bbef8ad41dc660115f75bb0bbbfcbc60b7 Mon Sep 17 00:00:00 2001 From: Craig Bryant Date: Tue, 4 Nov 2014 13:24:29 -0700 Subject: [PATCH] Have change_alarm_state return success or failure And actually check it in smoke.py Change-Id: I888bca006b5c0e82dd11601a2e5824579fad1048 --- tests/cli_wrapper.py | 3 ++- tests/smoke.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/cli_wrapper.py b/tests/cli_wrapper.py index 2d67e19..1fe28bf 100644 --- a/tests/cli_wrapper.py +++ b/tests/cli_wrapper.py @@ -71,7 +71,8 @@ def change_alarm_state(alarm_id, new_state): if result_json['state'] != new_state: print('Alarm patch failed, expected state of %s but was %s' % (result_json['state'], new_state), file=sys.stderr) - return 1 + return False + return True def find_alarms_for_definition(alarm_definition_id): diff --git a/tests/smoke.py b/tests/smoke.py index 1c00d76..5bacfc3 100755 --- a/tests/smoke.py +++ b/tests/smoke.py @@ -207,7 +207,10 @@ def smoke_test(mail_host, metric_host): new_state = 'OK' 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 # will be fixed and this will fail if len(sys.argv) > 1: