From 977774bf58ee3bc8787f95521a0fcd416c937c1e Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Tue, 1 Oct 2024 10:41:25 -0700 Subject: [PATCH 1/2] Adding support for multiple error msgs --- qa/L0_python_api/test_kserve.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qa/L0_python_api/test_kserve.py b/qa/L0_python_api/test_kserve.py index 703d86ca43..5fda8a271d 100644 --- a/qa/L0_python_api/test_kserve.py +++ b/qa/L0_python_api/test_kserve.py @@ -241,11 +241,18 @@ def callback(user_data, result, error): time_out = time_out - 1 time.sleep(1) + # Depending on when gRPC frontend shut down StatusCode can vary + acceptable_failure_msgs = set( + [ + "[StatusCode.CANCELLED] CANCELLED", + "[StatusCode.UNAVAILABLE] failed to connect to all addresses", + ] + ) + assert ( len(user_data) == 1 and isinstance(user_data[0], InferenceServerException) - and "[StatusCode.UNAVAILABLE] failed to connect to all addresses" - in str(user_data[0]) + and str(user_data[0]) in acceptable_failure_msgs ) teardown_client(grpc_client) From 0da316038909e5db4f66a10e96b1af04c1a077b4 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Tue, 1 Oct 2024 11:10:53 -0700 Subject: [PATCH 2/2] Fixing error message substr check --- qa/L0_python_api/test_kserve.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/qa/L0_python_api/test_kserve.py b/qa/L0_python_api/test_kserve.py index 5fda8a271d..f9af5b3b22 100644 --- a/qa/L0_python_api/test_kserve.py +++ b/qa/L0_python_api/test_kserve.py @@ -242,17 +242,18 @@ def callback(user_data, result, error): time.sleep(1) # Depending on when gRPC frontend shut down StatusCode can vary - acceptable_failure_msgs = set( - [ - "[StatusCode.CANCELLED] CANCELLED", - "[StatusCode.UNAVAILABLE] failed to connect to all addresses", - ] - ) + acceptable_failure_msgs = [ + "[StatusCode.CANCELLED] CANCELLED", + "[StatusCode.UNAVAILABLE] failed to connect to all addresses", + ] assert ( len(user_data) == 1 and isinstance(user_data[0], InferenceServerException) - and str(user_data[0]) in acceptable_failure_msgs + and any( + failure_msg in str(user_data[0]) + for failure_msg in acceptable_failure_msgs + ) ) teardown_client(grpc_client)