From 74745b9bea40cc2393402532c863d2eb8425cb03 Mon Sep 17 00:00:00 2001 From: James Saryerwinnie Date: Wed, 11 Sep 2024 17:18:23 -0400 Subject: [PATCH] Add additional waiter config validation for matching error codes We should validate that if an error matcher references an error code, then the operation actually has a modeled error with a matching code. This won't pass as is, so I'm adding this as a reference for now. We likely won't be able to get all the service models updated immediately, so we may need to allow list existing cases that are valid but not fully modeled. --- tests/functional/test_waiter_config.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/functional/test_waiter_config.py b/tests/functional/test_waiter_config.py index fc1ab619fb..40c81fcee1 100644 --- a/tests/functional/test_waiter_config.py +++ b/tests/functional/test_waiter_config.py @@ -165,6 +165,17 @@ def _validate_acceptor(acceptor, op_model, waiter_name): f"'{waiter_name}' with non list result in JMESPath expression: " f"{expression}" ) + if acceptor.matcher == 'error': + expected_code = acceptor.expected + all_codes = [shape.error_code for shape in op_model.error_shapes] + if expected_code not in all_codes: + raise AssertionError( + f"The '{waiter_name}' waiter for the " + f"'{op_model.service_model.service_name}' service that defines" + f"a matcher with error code {expected_code} that's not in " + f"the error codes defined in the {op_model.name} operation " + f"model: {', '.join(all_codes)}" + ) def _search_jmespath_expression(expression, op_model):