From 59cddc253ffebd68aa5995130a2b42f8d5db4c58 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Wed, 28 Jul 2021 20:50:48 +0300 Subject: [PATCH 1/2] Fix E2E tests --- test/e2e/e2e/tests.py | 7 ------- test/e2e/e2e/utils.py | 15 ++++----------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/test/e2e/e2e/tests.py b/test/e2e/e2e/tests.py index 5fe72a2b98..59a5c65e24 100644 --- a/test/e2e/e2e/tests.py +++ b/test/e2e/e2e/tests.py @@ -36,7 +36,6 @@ from e2e.utils import ( apis_ready, api_updated, - api_requests, wait_on_event, wait_on_futures, endpoint_ready, @@ -845,7 +844,6 @@ def test_long_running_realtime( assert len(api_specs) == 1 time_to_run = long_running_config["time_to_run"] - status_code_timeout = long_running_config["status_code_timeout"] if len(node_groups) > 0: api_specs[0]["node_groups"] = node_groups @@ -881,11 +879,6 @@ def test_long_running_realtime( counter += 1 - printer("verifying number of processed requests using the client") - assert api_requests( - client, api_name, counter, timeout=status_code_timeout - ), f"the number of 2xx response codes for api {api_name} doesn't match the expected number {counter}" - except: # best effort try: diff --git a/test/e2e/e2e/utils.py b/test/e2e/e2e/utils.py index 52020a037c..a9780f6e80 100644 --- a/test/e2e/e2e/utils.py +++ b/test/e2e/e2e/utils.py @@ -38,9 +38,11 @@ def wait_for(fn: Callable[[], bool], timeout=None) -> bool: def apis_ready(client: cx.Client, api_names: List[str], timeout: Optional[int] = None) -> bool: + def _check_liveness(status): + return status["requested"] == status["ready"] == status["up_to_date"] def _is_ready(): return all( - [client.get_api(name)["status"]["status_code"] == "status_live" for name in api_names] + [_check_liveness(client.get_api(name)["status"]) for name in api_names] ) return wait_for(_is_ready, timeout=timeout) @@ -49,16 +51,7 @@ def _is_ready(): def api_updated(client: cx.Client, api_name: str, timeout: Optional[int] = None) -> bool: def _is_ready(): status = client.get_api(api_name)["status"] - return status["replica_counts"]["requested"] == status["replica_counts"]["updated"]["ready"] - - return wait_for(_is_ready, timeout=timeout) - - -def api_requests( - client: cx.Client, api_name: str, target_requests: int, timeout: Optional[int] = None -) -> bool: - def _is_ready(): - return client.get_api(api_name)["metrics"]["network_stats"]["code_2xx"] == target_requests + return status["requested"] == status["ready"] return wait_for(_is_ready, timeout=timeout) From 714cd54828b6c3661b2e9f5a2f70c7b49e5a0276 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Wed, 28 Jul 2021 20:51:40 +0300 Subject: [PATCH 2/2] Black format --- test/e2e/e2e/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/e2e/e2e/utils.py b/test/e2e/e2e/utils.py index a9780f6e80..27d12f46af 100644 --- a/test/e2e/e2e/utils.py +++ b/test/e2e/e2e/utils.py @@ -40,10 +40,9 @@ def wait_for(fn: Callable[[], bool], timeout=None) -> bool: def apis_ready(client: cx.Client, api_names: List[str], timeout: Optional[int] = None) -> bool: def _check_liveness(status): return status["requested"] == status["ready"] == status["up_to_date"] + def _is_ready(): - return all( - [_check_liveness(client.get_api(name)["status"]) for name in api_names] - ) + return all([_check_liveness(client.get_api(name)["status"]) for name in api_names]) return wait_for(_is_ready, timeout=timeout)