From a314a82d277330a0eafd7bf6a9ccb49cc4dcc82e Mon Sep 17 00:00:00 2001 From: Liam Young Date: Thu, 26 Apr 2018 11:30:19 +0100 Subject: [PATCH] Always use startswith for checking WL status msgs (#42) Currently there is no way for the tests.yaml to specify if the expected workload status message should be checked as a prefix or as an exact match. I think the prefix approach actually covers all our use cases so rather than complicate the tests.yaml options lets just always use startswith for checks. --- zaza/model.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/zaza/model.py b/zaza/model.py index a355e49..f3485fc 100644 --- a/zaza/model.py +++ b/zaza/model.py @@ -532,19 +532,15 @@ async def async_wait_for_application_states(model_name, states=None, logging.info("Checking workload status message of {}".format( unit.entity_id)) if check_msg: - await model.block_until( - lambda: check_unit_workload_status_message( - model, - unit, - message=check_msg), - timeout=timeout) + prefixes = (check_msg) else: - await model.block_until( - lambda: check_unit_workload_status_message( - model, - unit, - prefixes=approved_message_prefixes), - timeout=timeout) + prefixes = approved_message_prefixes + await model.block_until( + lambda: check_unit_workload_status_message( + model, + unit, + prefixes=prefixes), + timeout=timeout) wait_for_application_states = sync_wrapper(async_wait_for_application_states)