From 7022278ce9b9830286f3747d3d070282bb27cea3 Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Tue, 1 Dec 2020 13:42:21 -0800 Subject: [PATCH] Deflake Serve tests (#12542) --- ci/travis/ci.sh | 1 + python/ray/serve/tests/test_api.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ci/travis/ci.sh b/ci/travis/ci.sh index 1e236e6e0d127..843515400e5b4 100755 --- a/ci/travis/ci.sh +++ b/ci/travis/ci.sh @@ -139,6 +139,7 @@ test_python() { args+=( python/ray/serve/... python/ray/tests/... + -python/ray/serve:test_api # segfault on windows? https://github.com/ray-project/ray/issues/12541 -python/ray/tests:test_advanced_2 -python/ray/tests:test_advanced_3 # test_invalid_unicode_in_worker_log() fails on Windows -python/ray/tests:test_autoscaler_aws diff --git a/python/ray/serve/tests/test_api.py b/python/ray/serve/tests/test_api.py index c329d2bfadeac..93ea187f4cd3d 100644 --- a/python/ray/serve/tests/test_api.py +++ b/python/ray/serve/tests/test_api.py @@ -364,7 +364,16 @@ def function2(_): client.create_backend("delete:v1", function2) client.set_traffic("delete_backend", {"delete:v1": 1.0}) - assert requests.get("http://127.0.0.1:8000/delete-backend").text == "olleh" + for _ in range(10): + try: + assert requests.get( + "http://127.0.0.1:8000/delete-backend").text == "olleh" + break + except AssertionError: + time.sleep(0.5) # wait for the traffic policy to propogate + else: + assert requests.get( + "http://127.0.0.1:8000/delete-backend").text == "olleh" @pytest.mark.parametrize("route", [None, "/delete-endpoint"])