diff options
Diffstat (limited to 'buildscripts/tests/test_selected_tests.py')
| -rw-r--r-- | buildscripts/tests/test_selected_tests.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/buildscripts/tests/test_selected_tests.py b/buildscripts/tests/test_selected_tests.py index 85725e60858..70689345b69 100644 --- a/buildscripts/tests/test_selected_tests.py +++ b/buildscripts/tests/test_selected_tests.py @@ -24,7 +24,7 @@ from buildscripts.task_generation.task_types.gentask_options import GenTaskOptio from buildscripts.tests.test_burn_in_tests import get_evergreen_config, mock_changed_git_files from buildscripts import selected_tests as under_test -# pylint: disable=missing-docstring,invalid-name,unused-argument,protected-access,no-value-for-parameter,too-many-locals +# pylint: disable=missing-docstring,invalid-name,unused-argument,protected-access,no-value-for-parameter NS = "buildscripts.selected_tests" @@ -101,9 +101,7 @@ class TestAcceptance(unittest.TestCase): self.assertEqual(generated_config.file_list[0].file_name, "selected_tests_config.json") @unittest.skipIf(sys.platform.startswith("win"), "not supported on windows") - @patch("buildscripts.util.teststats.HistoricTaskData.get_stats_from_s3") - def test_when_test_mappings_are_found_for_changed_files(self, get_stats_from_s3_mock): - get_stats_from_s3_mock.return_value = [] + def test_when_test_mappings_are_found_for_changed_files(self): mock_evg_api = self._mock_evg_api() mock_evg_config = get_evergreen_config("etc/evergreen.yml") mock_evg_expansions = under_test.EvgExpansions( @@ -135,7 +133,7 @@ class TestAcceptance(unittest.TestCase): # assert that generated suite files have the suite name and the variant name in the # filename, to prevent tasks on different variants from using the same suite file - self.assertIn("auth_enterprise-rhel-8-64-bit-dynamic-required_0.yml", files_to_generate) + self.assertIn("auth_enterprise-rhel-80-64-bit-dynamic-required_0.yml", files_to_generate) generated_evg_config_raw = [ gen_file.content for gen_file in generated_config.file_list @@ -147,13 +145,11 @@ class TestAcceptance(unittest.TestCase): # jstests/auth/auth1.js belongs to two suites, auth and auth_audit, rhel_80_with_generated_tasks = next( (variant for variant in build_variants_with_generated_tasks - if variant["name"] == "enterprise-rhel-8-64-bit-dynamic-required"), None) + if variant["name"] == "enterprise-rhel-80-64-bit-dynamic-required"), None) self.assertEqual(len(rhel_80_with_generated_tasks["tasks"]), 2) @unittest.skipIf(sys.platform.startswith("win"), "not supported on windows") - @patch("buildscripts.util.teststats.HistoricTaskData.get_stats_from_s3") - def test_when_task_mappings_are_found_for_changed_files(self, get_stats_from_s3_mock): - get_stats_from_s3_mock.return_value = [] + def test_when_task_mappings_are_found_for_changed_files(self): mock_evg_api = self._mock_evg_api() mock_evg_config = get_evergreen_config("etc/evergreen.yml") mock_evg_expansions = under_test.EvgExpansions( @@ -168,7 +164,7 @@ class TestAcceptance(unittest.TestCase): mock_task_mapping = TaskMapping( branch="master", project="mongodb-mongo-master", repo="mongodb/mongo", source_file="src/file1.cpp", source_file_seen_count=8, - tasks=[TaskMapInstance(name="auth", variant="enterprise-rhel-8", flip_count=5)]) + tasks=[TaskMapInstance(name="auth", variant="enterprise-rhel-80", flip_count=5)]) mock_selected_tests_client = MagicMock() mock_selected_tests_client.get_task_mappings.return_value = TaskMappingsResponse( task_mappings=[mock_task_mapping]) @@ -194,7 +190,7 @@ class TestAcceptance(unittest.TestCase): build_variants_with_generated_tasks = generated_evg_config["buildvariants"] rhel_80_with_generated_tasks = next( (variant for variant in build_variants_with_generated_tasks - if variant["name"] == "enterprise-rhel-8-64-bit-dynamic-required"), None) + if variant["name"] == "enterprise-rhel-80-64-bit-dynamic-required"), None) self.assertEqual(len(rhel_80_with_generated_tasks["tasks"]), 5) @@ -404,6 +400,13 @@ class TestGetTaskConfigsForTaskMappings(unittest.TestCase): class TestRemoveRepoPathPrefix(unittest.TestCase): - def test_path_handling(self): - filepath = under_test._remove_repo_path_prefix("sample_directory/src/file1.cpp") - self.assertEqual(filepath, "sample_directory/src/file1.cpp") + def test_file_is_in_enterprise_modules(self): + filepath = under_test._remove_repo_path_prefix( + "src/mongo/db/modules/enterprise/src/file1.cpp") + + self.assertEqual(filepath, "src/file1.cpp") + + def test_file_is_not_in_enterprise_modules(self): + filepath = under_test._remove_repo_path_prefix("other_directory/src/file1.cpp") + + self.assertEqual(filepath, "other_directory/src/file1.cpp") |
