mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-45764: Generate resmoke tasks need to take setup time into account when setting timeouts
This commit is contained in:
parent
3edb43edb0
commit
d35374c3a5
@ -44,6 +44,7 @@ from buildscripts.patch_builds.task_generation import TimeoutInfo, resmoke_comma
|
||||
|
||||
LOGGER = structlog.getLogger(__name__)
|
||||
|
||||
AVG_SETUP_TIME = int(timedelta(minutes=5).total_seconds())
|
||||
DEFAULT_TEST_SUITE_DIR = os.path.join("buildscripts", "resmokeconfig", "suites")
|
||||
CONFIG_FILE = "./.evergreen.yml"
|
||||
MIN_TIMEOUT_SECONDS = int(timedelta(minutes=5).total_seconds())
|
||||
@ -415,7 +416,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):
|
||||
|
@ -517,18 +517,20 @@ class UpdateSuiteConfigTest(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):
|
||||
|
Loading…
Reference in New Issue
Block a user