def test_evg_config_has_timeouts_for_repeated_suites(self):
        options = self.generate_mock_options()
        options.repeat_suites = 5
        suites = self.generate_mock_suites(3)
        build_variant = BuildVariant("variant")

        generator = under_test.EvergreenConfigGenerator(
            suites, options, MagicMock())
        generator.generate_config(build_variant)

        shrub_project = ShrubProject.empty().add_build_variant(build_variant)
        config = shrub_project.as_dict()
        self.assertEqual(len(config["tasks"]), len(suites) + 1)
        command1 = config["tasks"][0]["commands"][2]
        self.assertIn(" --repeatSuites=5 ", command1["vars"]["resmoke_args"])
        self.assertIn(options.resmoke_args, command1["vars"]["resmoke_args"])
        timeout_cmd = config["tasks"][0]["commands"][0]
        self.assertEqual("timeout.update", timeout_cmd["command"])
        expected_timeout = under_test.calculate_timeout(
            suites[0].max_runtime, 3) * 5
        self.assertEqual(expected_timeout,
                         timeout_cmd["params"]["timeout_secs"])
        expected_exec_timeout = under_test.calculate_timeout(
            suites[0].get_runtime(), 3) * 5
        self.assertEqual(expected_exec_timeout,
                         timeout_cmd["params"]["exec_timeout_secs"])
    def test_evg_config_has_timeouts_for_repeated_suites(self):
        options = self.generate_mock_options()
        options.repeat_suites = 5
        suites = self.generate_mock_suites(3)

        config = grt.EvergreenConfigGenerator(suites, options, Mock()).generate_config().to_map()

        self.assertEqual(len(config["tasks"]), len(suites) + 1)
        command1 = config["tasks"][0]["commands"][2]
        self.assertIn(" --repeatSuites=5 ", command1["vars"]["resmoke_args"])
        self.assertIn(options.resmoke_args, command1["vars"]["resmoke_args"])
        timeout_cmd = config["tasks"][0]["commands"][0]
        self.assertEqual("timeout.update", timeout_cmd["command"])
        expected_timeout = grt.calculate_timeout(suites[0].max_runtime, 3) * 5
        self.assertEqual(expected_timeout, timeout_cmd["params"]["timeout_secs"])
        expected_exec_timeout = grt.calculate_timeout(suites[0].get_runtime(), 3) * 5
        self.assertEqual(expected_exec_timeout, timeout_cmd["params"]["exec_timeout_secs"])
    def test_evg_config_has_timeouts_for_repeated_suites(self):
        options = self.generate_mock_options()
        options.repeat_suites = 5
        suites = self.generate_mock_suites(3)

        config = grt.EvergreenConfigGenerator(suites, options, Mock()).generate_config().to_map()

        self.assertEqual(len(config["tasks"]), len(suites) + 1)
        command1 = config["tasks"][0]["commands"][2]
        self.assertIn(" --repeatSuites=5 ", command1["vars"]["resmoke_args"])
        self.assertIn(options.resmoke_args, command1["vars"]["resmoke_args"])
        timeout_cmd = config["tasks"][0]["commands"][0]
        self.assertEqual("timeout.update", timeout_cmd["command"])
        expected_timeout = grt.calculate_timeout(suites[0].max_runtime, 3) * 5
        self.assertEqual(expected_timeout, timeout_cmd["params"]["timeout_secs"])
        expected_exec_timeout = grt.calculate_timeout(suites[0].get_runtime(), 3) * 5
        self.assertEqual(expected_exec_timeout, timeout_cmd["params"]["exec_timeout_secs"])
示例#4
0
 def test_scaling_factor(self):
     scaling_factor = 10
     self.assertEqual(under_test.MIN_TIMEOUT_SECONDS * scaling_factor,
                      under_test.calculate_timeout(30, scaling_factor))
示例#5
0
 def test_float_runtimes(self):
     self.assertEqual(360, under_test.calculate_timeout(300.14, 1))
示例#6
0
 def test_over_timeout_by_one_minute(self):
     self.assertEqual(360, under_test.calculate_timeout(301, 1))
示例#7
0
 def test_min_timeout(self):
     self.assertEqual(under_test.MIN_TIMEOUT_SECONDS, under_test.calculate_timeout(15, 1))
 def test_scaling_factor(self):
     scaling_factor = 10
     self.assertEqual(grt.MIN_TIMEOUT_SECONDS * scaling_factor,
                      grt.calculate_timeout(30, scaling_factor))
 def test_float_runtimes(self):
     self.assertEqual(360, grt.calculate_timeout(300.14, 1))
 def test_over_timeout_by_one_minute(self):
     self.assertEqual(360, grt.calculate_timeout(301, 1))
 def test_min_timeout(self):
     self.assertEqual(grt.MIN_TIMEOUT_SECONDS, grt.calculate_timeout(15, 1))
示例#12
0
 def test_scaling_factor(self):
     self.assertEqual(600, grt.calculate_timeout(30, 10))
示例#13
0
 def test_min_timeout(self):
     self.assertEqual(300, grt.calculate_timeout(15, 1))
 def test_scaling_factor(self):
     self.assertEqual(600, grt.calculate_timeout(30, 10))
 def test_min_timeout(self):
     self.assertEqual(300, grt.calculate_timeout(15, 1))