From abd781d60731f8f32c2d36ad80c60035d84541f3 Mon Sep 17 00:00:00 2001 From: Yuhong Guo Date: Tue, 11 Dec 2018 03:46:40 +0800 Subject: [PATCH] Make stress test time shorter. (#3506) --- test/stress_tests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/stress_tests.py b/test/stress_tests.py index 3d4b0fb36..c65da083c 100644 --- a/test/stress_tests.py +++ b/test/stress_tests.py @@ -294,6 +294,12 @@ def test_simple(ray_start_reconstruction): del values +def sorted_random_indexes(total, output_num): + random_indexes = [np.random.randint(total) for _ in range(output_num)] + random_indexes.sort() + return random_indexes + + @pytest.mark.skipif( os.environ.get("RAY_USE_NEW_GCS") == "on", reason="Failing with new GCS API on Linux.") @@ -338,8 +344,8 @@ def test_recursive(ray_start_reconstruction): value = ray.get(args[i]) assert value[0] == i # Get 10 values randomly. - for _ in range(10): - i = np.random.randint(num_objects) + random_indexes = sorted_random_indexes(num_objects, 10) + for i in random_indexes: value = ray.get(args[i]) assert value[0] == i # Get values sequentially, in chunks. @@ -398,8 +404,8 @@ def test_multiple_recursive(ray_start_reconstruction): value = ray.get(args[i]) assert value[0] == i # Get 10 values randomly. - for _ in range(10): - i = np.random.randint(num_objects) + random_indexes = sorted_random_indexes(num_objects, 10) + for i in random_indexes: value = ray.get(args[i]) assert value[0] == i