summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuildscripts/evergreen_generate_resmoke_tasks.py2
-rw-r--r--buildscripts/tests/test_evergreen_generate_resmoke_tasks.py21
2 files changed, 23 insertions, 0 deletions
diff --git a/buildscripts/evergreen_generate_resmoke_tasks.py b/buildscripts/evergreen_generate_resmoke_tasks.py
index 25283dd518b..b6d13b737eb 100755
--- a/buildscripts/evergreen_generate_resmoke_tasks.py
+++ b/buildscripts/evergreen_generate_resmoke_tasks.py
@@ -604,6 +604,8 @@ class Main(object):
"""Divide tests into suites that can be run in less than the specified execution time."""
test_stats = TestStats(data)
tests_runtimes = self.filter_existing_tests(test_stats.get_tests_runtimes())
+ if not tests_runtimes:
+ return self.calculate_fallback_suites()
self.test_list = [info[0] for info in tests_runtimes]
return divide_tests_into_suites(tests_runtimes, execution_time_secs,
self.options.max_sub_suites)
diff --git a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py
index aa73579d9ce..1662340eba6 100644
--- a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py
+++ b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py
@@ -550,6 +550,27 @@ class MainTest(unittest.TestCase):
self.assertEqual(n_tests, len(main.test_list))
+ def test_calculate_suites_uses_fallback_if_only_results_are_filtered(self):
+ n_tests = 100
+ evg = Mock()
+ evg.test_stats.return_value = [{
+ "test_file": "test{}.js".format(i), "avg_duration_pass": 60, "num_pass": 1
+ } for i in range(100)]
+
+ main = grt.Main(evg)
+ main.options = Mock()
+ main.config_options = self.get_mock_options()
+ main.list_tests = Mock(return_value=["test{}.js".format(i) for i in range(n_tests)])
+ with patch("os.path.exists") as exists_mock:
+ exists_mock.return_value = False
+ suites = main.calculate_suites(_DATE, _DATE)
+
+ self.assertEqual(main.config_options.fallback_num_sub_suites, len(suites))
+ for suite in suites:
+ self.assertEqual(50, len(suite.tests))
+
+ self.assertEqual(n_tests, len(main.test_list))
+
def test_calculate_suites_error(self):
response = Mock()
response.status_code = requests.codes.INTERNAL_SERVER_ERROR