diff options
author | David Bradford <david.bradford@mongodb.com> | 2019-01-23 12:10:41 -0500 |
---|---|---|
committer | David Bradford <david.bradford@mongodb.com> | 2019-02-05 14:25:33 -0500 |
commit | 17f25a473b0f1f7f132fecbc41581224aa324828 (patch) | |
tree | 837983dc1353447f1623f80c2d490c64060668c8 /buildscripts/tests | |
parent | f31cd5adaafd74b57317c4e7403123feea69d347 (diff) | |
download | mongo-17f25a473b0f1f7f132fecbc41581224aa324828.tar.gz |
SERVER-39138: Properly handle new suites when splitting suites
(cherry picked from commit eee822dc06f5f1514cb1a3f5930940ccf95f2e41)
Diffstat (limited to 'buildscripts/tests')
-rw-r--r-- | buildscripts/tests/test_evergreen_generate_resmoke_tasks.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py index 767b8891922..af6fdadf9d1 100644 --- a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py +++ b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py @@ -473,6 +473,7 @@ class MainTest(unittest.TestCase): self.assertEqual(10, len(suite.tests)) def test_calculate_suites_fallback(self): + n_tests = 100 response = Mock() response.status_code = requests.codes.SERVICE_UNAVAILABLE evg = Mock() @@ -482,14 +483,33 @@ class MainTest(unittest.TestCase): main.options = Mock() main.options.execution_time_minutes = 10 main.config_options = self.get_mock_options() - main.list_tests = Mock(return_value=["test{}.js".format(i) for i in range(100)]) + main.list_tests = Mock(return_value=["test{}.js".format(i) for i in range(n_tests)]) + + 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_uses_fallback_for_no_results(self): + n_tests = 100 + evg = Mock() + evg.test_stats.return_value = [] + + 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)]) 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 |