def test_create_task_list_no_variant(self): variant = "novariant" evg_conf_mock = MagicMock() evg_conf_mock.get_variant.return_value = None suites = {} with self.assertRaises(ValueError): under_test.create_task_list(EVERGREEN_CONF, variant, suites, [])
def test_build_variant_not_in_evg_project_config(self): variant = "novariant" evg_conf_mock = MagicMock() evg_conf_mock.get_variant.return_value = None suite_dict = {} with self.assertRaises(ValueError): under_test.create_task_list(evg_conf_mock, variant, suite_dict, [])
def test_create_task_list_novariant(self): class BadVariant(Exception): pass def _raise_bad_variant(code=0): raise BadVariant("Bad variant {}".format(code)) variant = "novariant" suites = [SUITE1, SUITE2, SUITE3] suite_list = _create_executor_list(suites, []) with patch("sys.exit", _raise_bad_variant): with self.assertRaises(BadVariant): burn_in.create_task_list(self.evergreen_conf, variant, suite_list, [])
def test_create_task_list_no_suites(self): variant = "variant2" suite_list = {} exclude_suites = ["suite2"] task_list = burn_in.create_task_list(self.evergreen_conf, variant, suite_list, exclude_suites) self.assertEqual(task_list, {})
def test_create_task_list(self): variant = "variantall" suites = [SUITE1, SUITE2, SUITE3] exclude_suites = [] suite_list = _create_executor_list(suites, exclude_suites) task_list = under_test.create_task_list(EVERGREEN_CONF, variant, suite_list, exclude_suites) self.assertEqual(len(task_list), len(VARIANTS["variantall"].tasks)) self.assertIn("task1", task_list) self.assertEqual(task_list["task1"]["resmoke_args"], "--suites=suite1 var1arg1") self.assertEqual(task_list["task1"]["tests"], SUITE1.tests) self.assertIsNone(task_list["task1"]["use_multiversion"]) self.assertIn("task2", task_list) self.assertEqual(task_list["task2"]["resmoke_args"], "--suites=suite1 var1arg2") self.assertEqual(task_list["task2"]["tests"], SUITE1.tests) self.assertIsNone(task_list["task2"]["use_multiversion"]) self.assertIn("task3", task_list) self.assertEqual(task_list["task3"]["resmoke_args"], "--suites=suite1 var1arg3") self.assertEqual(task_list["task3"]["tests"], SUITE1.tests) self.assertIsNone(task_list["task3"]["use_multiversion"])
def test_create_task_list_no_suites(self): variant = "variant name" evg_conf_mock = MagicMock() suite_dict = {} task_list = under_test.create_task_list(evg_conf_mock, variant, suite_dict, []) self.assertEqual(task_list, {})
def test_create_task_list_multiversion(self): variant = "variant_multiversion" suites = [SUITE1, SUITE2, SUITE3] exclude_suites = [] suite_list = _create_executor_list(suites, exclude_suites) task_list = under_test.create_task_list(EVERGREEN_CONF, variant, suite_list, exclude_suites) self.assertEqual(len(task_list), len(VARIANTS["variant_multiversion"].tasks)) self.assertEqual(task_list["multiversion_task"]["use_multiversion"], MULTIVERSION_PATH)
def test_create_task_list_with_excludes(self): variant = "variant2" suites = [SUITE1, SUITE2, SUITE3] suite_list = _create_executor_list(suites, []) exclude_suites = ["suite2"] task_list = burn_in.create_task_list(self.evergreen_conf, variant, suite_list, exclude_suites) self.assertIn("task3", task_list) self.assertEqual(task_list["task3"]["resmoke_args"], "--suites=suite3 var2arg3") self.assertEqual(task_list["task3"]["tests"], SUITE3.tests) self.assertNotIn("task1", task_list) self.assertNotIn("task2", task_list)
def test_create_task_list_no_excludes(self): variant = "variant1" suites = [SUITE1, SUITE2] exclude_suites = [] suite_list = _create_executor_list(suites, exclude_suites) task_list = burn_in.create_task_list(self.evergreen_conf, variant, suite_list, exclude_suites) self.assertIn("task1", task_list) self.assertEqual(task_list["task1"]["resmoke_args"], "--suites=suite1 var1arg1") self.assertEqual(task_list["task1"]["tests"], SUITE1.tests) self.assertNotIn("task2", task_list) self.assertNotIn("task3", task_list)
def test_create_task_list_gen_tasks_no_suite(self): variant = "variant_generate_tasks_no_suite" suites = [SUITE3] exclude_suites = [] suite_list = _create_executor_list(suites, exclude_suites) task_list = under_test.create_task_list(EVERGREEN_CONF, variant, suite_list, exclude_suites) self.assertEqual( len(task_list), len(VARIANTS["variant_generate_tasks_no_suite"].tasks)) self.assertIn(GENERATE_RESMOKE_TASKS_BASENAME, task_list) self.assertEqual(task_list[GENERATE_RESMOKE_TASKS_BASENAME]["tests"], SUITE3.tests)
def test_create_task_list_gen_tasks_multiversion(self): variant = "variant_generate_tasks_multiversion" suites = [SUITE3] exclude_suites = [] suite_list = _create_executor_list(suites, exclude_suites) task_list = under_test.create_task_list(EVERGREEN_CONF, variant, suite_list, exclude_suites) self.assertEqual( len(task_list), len(VARIANTS["variant_generate_tasks_multiversion"].tasks)) self.assertEqual( task_list[GENERATE_RESMOKE_TASKS_BASENAME]["use_multiversion"], MULTIVERSION_PATH)
def test_create_task_list_with_excludes(self): variant = "variant2" suites = [SUITE1, SUITE2, SUITE3] suite_list = _create_executor_list(suites, []) exclude_suites = ["suite2"] task_list = under_test.create_task_list(EVERGREEN_CONF, variant, suite_list, exclude_suites) self.assertEqual(len(task_list), 1) self.assertIn("task3", task_list) self.assertEqual(task_list["task3"]["resmoke_args"], "--suites=suite3 var2arg3") self.assertEqual(task_list["task3"]["tests"], SUITE3.tests) self.assertNotIn("task1", task_list) self.assertNotIn("task2", task_list)
def test_create_task_list_no_excludes(self): variant = "variant1" suites = [SUITE1, SUITE2] exclude_suites = [] suite_list = _create_executor_list(suites, exclude_suites) task_list = under_test.create_task_list(EVERGREEN_CONF, variant, suite_list, exclude_suites) self.assertEqual(len(task_list), 1) self.assertIn("task1", task_list) self.assertEqual(task_list["task1"]["resmoke_args"], "--suites=suite1 var1arg1") self.assertEqual(task_list["task1"]["tests"], SUITE1.tests) self.assertNotIn("task2", task_list) self.assertNotIn("task3", task_list)
def test_create_task_list_with_excludes(self): variant = "variant name" evg_conf_mock = MagicMock() evg_conf_mock.get_variant.return_value.tasks = [ create_variant_task_mock("task 1", "suite 1"), create_variant_task_mock("task 2", "suite 2"), create_variant_task_mock("task 3", "suite 3"), ] tests_by_suite = { "suite 1": [f"test{i}.js" for i in range(3)], "suite 2": [f"test{i}.js" for i in range(1)], "suite 3": [f"test{i}.js" for i in range(2)], } exclude_tasks = ["task 2"] task_list = under_test.create_task_list(evg_conf_mock, variant, tests_by_suite, exclude_tasks) self.assertIn("task 1", task_list) self.assertNotIn("task 2", task_list) self.assertIn("task 3", task_list) self.assertEqual(2, len(task_list))
def test_create_task_list_has_correct_task_info(self): variant = "variant name" evg_conf_mock = MagicMock() evg_conf_mock.get_variant.return_value.tasks = [ create_variant_task_mock("task 1", "suite_1", "distro 1"), ] evg_conf_mock.get_task.return_value.run_on = ["distro 1"] tests_by_suite = { "suite_1": [f"test{i}.js" for i in range(3)], } exclude_tasks = [] task_list = under_test.create_task_list(evg_conf_mock, variant, tests_by_suite, exclude_tasks) self.assertIn("task 1", task_list) task_info = task_list["task 1"] self.assertIn("suite_1", task_info.resmoke_args) for i in range(3): self.assertIn(f"test{i}.js", task_info.tests) self.assertFalse(task_info.require_multiversion_setup) self.assertEqual("distro 1", task_info.distro)