From 4d3e1a019f2de25c654bd274927db54b8c2e4922 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Tue, 3 Aug 2021 18:11:43 +0300 Subject: [PATCH 1/4] Attempt to fix the E2E tests --- test/e2e/e2e/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/e2e/e2e/utils.py b/test/e2e/e2e/utils.py index 27d12f46af..1060eeca73 100644 --- a/test/e2e/e2e/utils.py +++ b/test/e2e/e2e/utils.py @@ -39,7 +39,10 @@ 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"] + return ( + status["requested"] > 0 + and 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]) From 5bec6358c59ed663ca43c1f6200fda1e0f5814b9 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Tue, 3 Aug 2021 21:55:22 +0300 Subject: [PATCH 2/4] Fix scale-to-zero E2E test --- test/e2e/e2e/tests.py | 2 +- test/e2e/e2e/utils.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/e2e/e2e/tests.py b/test/e2e/e2e/tests.py index 59a5c65e24..4647fb12d2 100644 --- a/test/e2e/e2e/tests.py +++ b/test/e2e/e2e/tests.py @@ -908,7 +908,7 @@ def test_realtime_scale_to_zero( try: assert apis_ready( - client=client, api_names=[api_name], timeout=timeout + client=client, api_names=[api_name], timeout=timeout, greater_or_equal_than=0 ), f"apis {api_name} not ready" api_info = client.get_api(api_name) diff --git a/test/e2e/e2e/utils.py b/test/e2e/e2e/utils.py index 1060eeca73..4bcd95dae3 100644 --- a/test/e2e/e2e/utils.py +++ b/test/e2e/e2e/utils.py @@ -37,10 +37,15 @@ def wait_for(fn: Callable[[], bool], timeout=None) -> bool: time.sleep(1) -def apis_ready(client: cx.Client, api_names: List[str], timeout: Optional[int] = None) -> bool: +def apis_ready( + client: cx.Client, + api_names: List[str], + timeout: Optional[int] = None, + greater_or_equal_than: int = 1, +) -> bool: def _check_liveness(status): return ( - status["requested"] > 0 + status["requested"] >= greater_or_equal_than and status["requested"] == status["ready"] == status["up_to_date"] ) From ebd363a08654c85f68a3c88692937e8a647c15e9 Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Tue, 3 Aug 2021 23:36:32 +0300 Subject: [PATCH 3/4] Address nit --- test/e2e/e2e/tests.py | 2 +- test/e2e/e2e/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/e2e/tests.py b/test/e2e/e2e/tests.py index 4647fb12d2..6e6f2fa2db 100644 --- a/test/e2e/e2e/tests.py +++ b/test/e2e/e2e/tests.py @@ -908,7 +908,7 @@ def test_realtime_scale_to_zero( try: assert apis_ready( - client=client, api_names=[api_name], timeout=timeout, greater_or_equal_than=0 + client=client, api_names=[api_name], timeout=timeout, greater_or_equal_to=0 ), f"apis {api_name} not ready" api_info = client.get_api(api_name) diff --git a/test/e2e/e2e/utils.py b/test/e2e/e2e/utils.py index 4bcd95dae3..296f516ffd 100644 --- a/test/e2e/e2e/utils.py +++ b/test/e2e/e2e/utils.py @@ -41,11 +41,11 @@ def apis_ready( client: cx.Client, api_names: List[str], timeout: Optional[int] = None, - greater_or_equal_than: int = 1, + greater_or_equal_to: int = 1, ) -> bool: def _check_liveness(status): return ( - status["requested"] >= greater_or_equal_than + status["requested"] >= greater_or_equal_to and status["requested"] == status["ready"] == status["up_to_date"] ) From c86ece3a57740af1b9995d82753effb6bba3eddd Mon Sep 17 00:00:00 2001 From: Robert Lucian Chiriac Date: Wed, 4 Aug 2021 00:42:51 +0300 Subject: [PATCH 4/4] Fix `replica_counts` key not found --- test/e2e/e2e/tests.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/e2e/e2e/tests.py b/test/e2e/e2e/tests.py index 6e6f2fa2db..3f1fe51f3d 100644 --- a/test/e2e/e2e/tests.py +++ b/test/e2e/e2e/tests.py @@ -476,9 +476,7 @@ def test_autoscaling( assert api_updated( client, primary_api_name, timeout=deploy_timeout ), "api didn't scale up to the desired number of replicas in time" - current_replicas = client.get_api(primary_api_name)["status"]["replica_counts"][ - "requested" - ] + current_replicas = client.get_api(primary_api_name)["status"]["requested"] # stop the requests from being made if current_replicas == max_replicas and not request_stopper.is_set():