diff options
author | Alexander Costas <alexander.costas@mongodb.com> | 2020-01-27 10:52:36 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-05 16:57:49 +0000 |
commit | 23945fc3a8c9cc2bd63d7a25ce3034214d4114b8 (patch) | |
tree | cf819ec517444bd268d66a715cbea9247ccb9f82 | |
parent | 073da4c9ef0e5c23c3eb3e8094630191a646de58 (diff) | |
download | mongo-23945fc3a8c9cc2bd63d7a25ce3034214d4114b8.tar.gz |
SERVER-45764: Generate resmoke tasks need to take setup time into account when setting timeouts
-rwxr-xr-x | buildscripts/evergreen_generate_resmoke_tasks.py | 3 | ||||
-rw-r--r-- | buildscripts/tests/test_evergreen_generate_resmoke_tasks.py | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/buildscripts/evergreen_generate_resmoke_tasks.py b/buildscripts/evergreen_generate_resmoke_tasks.py index a5dd4773a07..36986b28f2d 100755 --- a/buildscripts/evergreen_generate_resmoke_tasks.py +++ b/buildscripts/evergreen_generate_resmoke_tasks.py @@ -42,6 +42,7 @@ LOGGER = structlog.getLogger(__name__) TEST_SUITE_DIR = os.path.join("buildscripts", "resmokeconfig", "suites") CONFIG_DIR = "generated_resmoke_config" +AVG_SETUP_TIME = int(timedelta(minutes=5).total_seconds()) CONFIG_FILE = "./.evergreen.yml" MIN_TIMEOUT_SECONDS = int(timedelta(minutes=5).total_seconds()) LOOKBACK_DURATION_DAYS = 14 @@ -358,7 +359,7 @@ def calculate_timeout(avg_runtime, scaling_factor): distance_to_min = 60 - (runtime % 60) return int(math.ceil(runtime + distance_to_min)) - return max(MIN_TIMEOUT_SECONDS, round_to_minute(avg_runtime)) * scaling_factor + return max(MIN_TIMEOUT_SECONDS, round_to_minute(avg_runtime)) * scaling_factor + AVG_SETUP_TIME def should_tasks_be_generated(evg_api, task_id): diff --git a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py index e4c4e1bb2a1..b62027b8bea 100644 --- a/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py +++ b/buildscripts/tests/test_evergreen_generate_resmoke_tasks.py @@ -448,18 +448,20 @@ class PrepareDirectoryForSuite(unittest.TestCase): class CalculateTimeoutTest(unittest.TestCase): def test_min_timeout(self): - self.assertEqual(under_test.MIN_TIMEOUT_SECONDS, under_test.calculate_timeout(15, 1)) + self.assertEqual(under_test.MIN_TIMEOUT_SECONDS + under_test.AVG_SETUP_TIME, + under_test.calculate_timeout(15, 1)) def test_over_timeout_by_one_minute(self): - self.assertEqual(360, under_test.calculate_timeout(301, 1)) + self.assertEqual(660, under_test.calculate_timeout(301, 1)) def test_float_runtimes(self): - self.assertEqual(360, under_test.calculate_timeout(300.14, 1)) + self.assertEqual(660, under_test.calculate_timeout(300.14, 1)) def test_scaling_factor(self): scaling_factor = 10 - self.assertEqual(under_test.MIN_TIMEOUT_SECONDS * scaling_factor, - under_test.calculate_timeout(30, scaling_factor)) + self.assertEqual( + under_test.MIN_TIMEOUT_SECONDS * scaling_factor + under_test.AVG_SETUP_TIME, + under_test.calculate_timeout(30, scaling_factor)) class EvergreenConfigGeneratorTest(unittest.TestCase): |