summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bradford <david.bradford@mongodb.com>2019-03-04 16:12:27 -0500
committerDavid Bradford <david.bradford@mongodb.com>2019-03-05 10:02:24 -0500
commit2706c9fdc71546897edb1a366240ca0062e79d3c (patch)
tree43d74049e6b2b23f9ab43386e556a426ab647cee
parent5366d3c6ea014f1bd19eee1a149f46f3b1227a2b (diff)
downloadmongo-2706c9fdc71546897edb1a366240ca0062e79d3c.tar.gz
SERVER-39946: Better split tasks with lack of history
(cherry picked from commit 2957deee8fc4ad595245ddb52013437e6b9ffdbd)
-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