summaryrefslogtreecommitdiff
path: root/buildscripts
diff options
context:
space:
mode:
authorDavid Bradford <david.bradford@mongodb.com>2020-08-24 19:04:28 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-05 21:44:41 +0000
commitce8b75a06ca10acf559211c1c0576287818a5c90 (patch)
treee0c390c75d87122c61c91228773eed1a739de237 /buildscripts
parent5ad3e5c6ade3ac13880ce44f94e5aff999e9ead5 (diff)
downloadmongo-ce8b75a06ca10acf559211c1c0576287818a5c90.tar.gz
SERVER-50401: Use evergreen manifest to determine revisions to compare against
(cherry picked from commit ac966012c5f16925226d0d42b43bd6ab92c7f59d)
Diffstat (limited to 'buildscripts')
-rw-r--r--buildscripts/burn_in_tags.py13
-rw-r--r--buildscripts/burn_in_tests.py46
-rw-r--r--buildscripts/burn_in_tests_multiversion.py2
-rw-r--r--buildscripts/linter/filediff.py29
-rw-r--r--buildscripts/patch_builds/change_data.py61
-rw-r--r--buildscripts/selected_tests.py9
-rw-r--r--buildscripts/tests/patch_builds/test_change_data.py91
-rw-r--r--buildscripts/tests/test_burn_in_tags.py11
-rw-r--r--buildscripts/tests/test_burn_in_tests.py15
-rw-r--r--buildscripts/tests/test_change_data.py42
-rw-r--r--buildscripts/tests/test_selected_tests.py9
11 files changed, 210 insertions, 118 deletions
diff --git a/buildscripts/burn_in_tags.py b/buildscripts/burn_in_tags.py
index a5d5efd1fb8..d4e49681139 100644
--- a/buildscripts/burn_in_tags.py
+++ b/buildscripts/burn_in_tags.py
@@ -1,10 +1,9 @@
#!/usr/bin/env python3
"""Generate burn in tests to run on certain build variants."""
-
from collections import namedtuple
import os
import sys
-from typing import Any, Dict, Iterable
+from typing import Any, Dict, List
import click
@@ -30,6 +29,7 @@ CONFIG_FILE = "burn_in_tags_gen.json"
EVERGREEN_FILE = "etc/evergreen.yml"
EVG_CONFIG_FILE = ".evergreen.yml"
COMPILE_TASK = "compile_without_package_TG"
+TASK_ID_EXPANSION = "task_id"
ConfigOptions = namedtuple("ConfigOptions", [
"build_variant",
@@ -123,7 +123,7 @@ def _generate_evg_build_variant(
# pylint: disable=too-many-arguments
def _generate_evg_tasks(evergreen_api: EvergreenApi, shrub_project: ShrubProject,
task_expansions: Dict[str, Any], build_variant_map: Dict[str, str],
- repos: Iterable[Repo], evg_conf: EvergreenProjectConfig) -> None:
+ repos: List[Repo], evg_conf: EvergreenProjectConfig) -> None:
"""
Generate burn in tests tasks for a given shrub config and group of build variants.
@@ -135,7 +135,8 @@ def _generate_evg_tasks(evergreen_api: EvergreenApi, shrub_project: ShrubProject
"""
for build_variant, run_build_variant in build_variant_map.items():
config_options = _get_config_options(task_expansions, build_variant, run_build_variant)
- changed_tests = find_changed_tests(repos)
+ task_id = task_expansions[TASK_ID_EXPANSION]
+ changed_tests = find_changed_tests(repos, evg_api=evergreen_api, task_id=task_id)
tests_by_task = create_tests_by_task(build_variant, evg_conf, changed_tests)
if tests_by_task:
shrub_build_variant = _generate_evg_build_variant(
@@ -153,12 +154,12 @@ def _generate_evg_tasks(evergreen_api: EvergreenApi, shrub_project: ShrubProject
def burn_in(task_expansions: Dict[str, Any], evg_conf: EvergreenProjectConfig,
- evergreen_api: RetryingEvergreenApi, repos: Iterable[Repo]):
+ evergreen_api: RetryingEvergreenApi, repos: List[Repo]):
"""
Execute main program.
:param task_expansions: Dictionary of expansions for the running task.
- :param evergreen_conf: Evergreen configuration.
+ :param evg_conf: Evergreen configuration.
:param evergreen_api: Evergreen.py object.
:param repos: Git repositories.
"""
diff --git a/buildscripts/burn_in_tests.py b/buildscripts/burn_in_tests.py
index b327456098d..715346f645c 100644
--- a/buildscripts/burn_in_tests.py
+++ b/buildscripts/burn_in_tests.py
@@ -9,7 +9,7 @@ import subprocess
import sys
from collections import defaultdict
from math import ceil
-from typing import Optional, Set, Tuple, List, Dict, Iterable
+from typing import Optional, Set, Tuple, List, Dict
import click
import requests
@@ -26,7 +26,8 @@ if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# pylint: disable=wrong-import-position
-from buildscripts.patch_builds.change_data import find_changed_files_in_repos
+from buildscripts.patch_builds.change_data import generate_revision_map, \
+ generate_revision_map_from_manifest, RevisionMap, find_changed_files_in_repos
import buildscripts.resmokelib.parser
from buildscripts.resmokelib.suitesconfig import create_test_membership_map, get_suites
from buildscripts.resmokelib.utils import default_if_none, globstar
@@ -201,25 +202,29 @@ def is_file_a_test_file(file_path: str) -> bool:
return True
-def get_revision_map(repos: Iterable[Repo], origin_rev: Optional[str] = None) -> Set[str]:
+def _create_revision_map(repos: List[Repo], origin_rev: Optional[str], evg_api: EvergreenApi,
+ task_id: Optional[str]) -> RevisionMap:
"""
- If origin_rev is specified, compare changes against this revision in the mongo repo.
+ Create a map of the repos and the given revisions to diff against.
- :param repos: List of repos containing changed files.
- :param origin_rev: The revision that local changes will be compared against.
- :returns: Set of changed tests.
+ :param repos: Repositories to include in the map.
+ :param origin_rev: User specified revision to compare against.
+ :param evg_api: Evergreen API client.
+ :param task_id: Evergreen task ID.
+ :return: Map of repositories to revisions.
"""
if origin_rev:
- mongo_repo_dir = [
- repo.git_dir for repo in repos if os.path.basename(repo.working_dir) == "mongo"
- ]
- if len(mongo_repo_dir) != 1:
- raise Exception("Mongo repo not found in repos list")
- return {mongo_repo_dir[0]: origin_rev}
- return None
+ return generate_revision_map(repos, {"mongo": origin_rev})
+ if evg_api and task_id:
+ return generate_revision_map_from_manifest(repos, task_id, evg_api)
-def find_changed_tests(repos: Iterable[Repo], origin_rev: Optional[str] = None) -> Set[str]:
+ return {}
+
+
+def find_changed_tests(repos: List[Repo], origin_rev: Optional[str] = None,
+ evg_api: Optional[EvergreenApi] = None,
+ task_id: Optional[str] = None) -> Set[str]:
"""
Find the changed tests.
@@ -228,9 +233,11 @@ def find_changed_tests(repos: Iterable[Repo], origin_rev: Optional[str] = None)
:param repos: List of repos containing changed files.
:param origin_rev: The revision that local changes will be compared against.
- :returns: Set of changed tests.
+ :param evg_api: Evergreen API client.
+ :param task_id: Evergreen task ID.
+ :return: Set of changed tests.
"""
- revision_map = get_revision_map(repos, origin_rev)
+ revision_map = _create_revision_map(repos, origin_rev, evg_api, task_id)
LOGGER.info("Calculated revision map", revision_map=revision_map)
changed_files = find_changed_files_in_repos(repos, revision_map)
return {os.path.normpath(path) for path in changed_files if is_file_a_test_file(path)}
@@ -755,7 +762,7 @@ def _get_evg_api(evg_api_config: str, local_mode: bool) -> Optional[EvergreenApi
def burn_in(repeat_config: RepeatConfig, generate_config: GenerateConfig, resmoke_args: str,
generate_tasks_file: str, no_exec: bool, evg_conf: EvergreenProjectConfig,
- repos: Iterable[Repo], evg_api: EvergreenApi, origin_rev: Optional[str]) -> None:
+ repos: List[Repo], evg_api: EvergreenApi, origin_rev: Optional[str]) -> None:
"""
Run burn_in_tests with the given configuration.
@@ -770,7 +777,7 @@ def burn_in(repeat_config: RepeatConfig, generate_config: GenerateConfig, resmok
:param project: Evergreen project to query.
:param origin_rev: The revision that local changes will be compared against.
"""
- changed_tests = find_changed_tests(repos, origin_rev)
+ changed_tests = find_changed_tests(repos, origin_rev, evg_api, generate_config.task_id)
LOGGER.info("Found changed tests", files=changed_tests)
# Populate the config values in order to use the helpers from resmokelib.suitesconfig.
@@ -871,6 +878,7 @@ def main(build_variant, run_build_variant, distro, project, generate_tasks_file,
:param local_mode: Don't call out to the evergreen API (used for testing).
:param evg_api_config: Location of configuration file to connect to evergreen.
:param verbose: Log extra debug information.
+ :param task_id: Id of evergreen task being run in.
:param origin_rev: The revision that local changes will be compared against.
"""
_configure_logging(verbose)
diff --git a/buildscripts/burn_in_tests_multiversion.py b/buildscripts/burn_in_tests_multiversion.py
index ad59089d46b..43943728f36 100644
--- a/buildscripts/burn_in_tests_multiversion.py
+++ b/buildscripts/burn_in_tests_multiversion.py
@@ -160,7 +160,7 @@ def main(build_variant, run_build_variant, distro, project, generate_tasks_file,
resmoke_cmd = _set_resmoke_cmd(repeat_config, list(resmoke_args))
- changed_tests = find_changed_tests(repos)
+ changed_tests = find_changed_tests(repos, evg_api=evg_api, task_id=task_id)
tests_by_task = create_tests_by_task(generate_config.build_variant, evg_conf, changed_tests)
LOGGER.debug("tests and tasks found", tests_by_task=tests_by_task)
diff --git a/buildscripts/linter/filediff.py b/buildscripts/linter/filediff.py
index de84691d1a3..7dbad6d9d58 100644
--- a/buildscripts/linter/filediff.py
+++ b/buildscripts/linter/filediff.py
@@ -12,29 +12,25 @@ if __name__ == "__main__" and __package__ is None:
# pylint: disable=wrong-import-position
from buildscripts.linter import git
-from buildscripts.patch_builds.change_data import find_changed_files_in_repos
+from buildscripts.patch_builds.change_data import generate_revision_map, \
+ RevisionMap, find_changed_files_in_repos
+
# pylint: enable=wrong-import-position
LOGGER = structlog.get_logger(__name__)
+MONGO_REVISION_ENV_VAR = "REVISION"
+ENTERPRISE_REVISION_ENV_VAR = "ENTERPRISE_REV"
-def _get_revision_for_repo(path: str) -> str:
- """
- Get the git revision for the given git repository.
-
- :param path: Path to git repository.
- :return: Git revision to compare against for given repo.
- """
- if "enterprise" in path:
- return os.environ.get("ENTERPRISE_REV")
- return os.environ.get("REVISION")
-
-
-def _get_repos_and_revisions() -> Tuple[List[Repo], Dict[str, str]]:
+def _get_repos_and_revisions() -> Tuple[List[Repo], RevisionMap]:
"""Get the repo object and a map of revisions to compare against."""
modules = git.get_module_paths()
repos = [Repo(path) for path in modules]
- revision_map = {repo.git_dir: _get_revision_for_repo(repo.git_dir) for repo in repos}
+ revision_map = generate_revision_map(
+ repos, {
+ "mongo": os.environ.get(MONGO_REVISION_ENV_VAR),
+ "enterprise": os.environ.get(ENTERPRISE_REVISION_ENV_VAR)
+ })
return repos, revision_map
@@ -49,7 +45,7 @@ def _filter_file(filename: str, is_interesting_file: Callable) -> bool:
return os.path.exists(filename) and is_interesting_file(filename)
-def gather_changed_files_for_lint(is_interesting_file: Callable):
+def gather_changed_files_for_lint(is_interesting_file: Callable) -> List[str]:
"""
Get the files that have changes since the last git commit.
@@ -65,5 +61,4 @@ def gather_changed_files_for_lint(is_interesting_file: Callable):
]
LOGGER.info("Found files to lint", files=files)
-
return files
diff --git a/buildscripts/patch_builds/change_data.py b/buildscripts/patch_builds/change_data.py
index 647ce2208d3..59d07dcb8b9 100644
--- a/buildscripts/patch_builds/change_data.py
+++ b/buildscripts/patch_builds/change_data.py
@@ -1,15 +1,60 @@
"""Tools for detecting changes in a commit."""
import os
from itertools import chain
-from typing import Any, Iterable, Set, Optional, Dict
+from typing import Any, Dict, Iterable, Set, Optional, List
import structlog
-from structlog.stdlib import LoggerFactory
+from evergreen import EvergreenApi
from git import DiffIndex, Repo
-structlog.configure(logger_factory=LoggerFactory())
LOGGER = structlog.get_logger(__name__)
+RevisionMap = Dict[str, str]
+
+
+def _get_id_from_repo(repo: Repo) -> str:
+ """
+ Get the identifier of the given repo.
+
+ :param repo: Repository to get id for.
+ :return: Identifier for repository.
+ """
+ if repo.working_dir == os.getcwd():
+ return "mongo"
+ return os.path.basename(repo.working_dir)
+
+
+def generate_revision_map(repos: List[Repo], revisions_data: Dict[str, str]) -> RevisionMap:
+ """
+ Generate a revision map for the given repositories using the revisions in the given file.
+
+ :param repos: Repositories to generate map for.
+ :param revisions_data: Dictionary of revisions to use for repositories.
+ :return: Map of repositories to revisions
+ """
+ revision_map = {repo.git_dir: revisions_data.get(_get_id_from_repo(repo)) for repo in repos}
+ return {k: v for k, v in revision_map.items() if v}
+
+
+def generate_revision_map_from_manifest(repos: List[Repo], task_id: str,
+ evg_api: EvergreenApi) -> RevisionMap:
+ """
+ Generate a revision map for the given repositories using the revisions from the manifest.
+
+ :param repos: Repositories to generate map for.
+ :param task_id: Id of evergreen task running.
+ :param evg_api: Evergreen API object.
+ :return: Map of repositories to revisions
+ """
+ manifest = evg_api.manifest_for_task(task_id)
+ revisions_data = {
+ module_name: module.revision
+ for module_name, module in manifest.modules.items()
+ }
+ revisions_data["mongo"] = manifest.revision
+
+ return generate_revision_map(repos, revisions_data)
+
def _paths_for_iter(diff, iter_type):
"""
@@ -47,7 +92,7 @@ def _modified_files_for_diff(diff: DiffIndex, log: Any) -> Set:
return modified_files.union(added_files).union(renamed_files).union(deleted_files)
-def find_changed_files(repo: Repo, revision_map: Optional[Dict[str, str]] = None) -> Set[str]:
+def find_changed_files(repo: Repo, revision_map: Optional[RevisionMap] = None) -> Set[str]:
"""
Find files that were new or added to the repository between commits.
@@ -71,20 +116,20 @@ def find_changed_files(repo: Repo, revision_map: Optional[Dict[str, str]] = None
paths = work_tree_files.union(index_files).union(untracked_files)
- return [
+ return {
os.path.relpath(f"{repo.working_dir}/{os.path.normpath(path)}", os.getcwd())
for path in paths
- ]
+ }
def find_changed_files_in_repos(repos: Iterable[Repo],
- revision_map: Optional[Dict[str, str]] = None) -> Set[str]:
+ revision_map: Optional[RevisionMap] = None) -> Set[str]:
"""
Find the changed files.
Use git to find which files have changed in this patch.
:param repos: List of repos containing changed files.
:param revision_map: Map of revisions to compare against for repos.
- :returns: Set of changed files.
+ :return: Set of changed files.
"""
return set(chain.from_iterable([find_changed_files(repo, revision_map) for repo in repos]))
diff --git a/buildscripts/selected_tests.py b/buildscripts/selected_tests.py
index b7711766d07..ff2179d7daa 100644
--- a/buildscripts/selected_tests.py
+++ b/buildscripts/selected_tests.py
@@ -15,6 +15,9 @@ from git import Repo
from shrub.v2 import ShrubProject, BuildVariant
# Get relative imports to work when the package is not installed on the PYTHONPATH.
+from buildscripts.patch_builds.change_data import find_changed_files_in_repos, \
+ generate_revision_map_from_manifest
+
if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -39,12 +42,12 @@ from buildscripts.evergreen_generate_resmoke_tasks import (
remove_gen_suffix,
write_file_dict,
)
-from buildscripts.patch_builds.change_data import find_changed_files_in_repos
from buildscripts.patch_builds.selected_tests_service import SelectedTestsService
structlog.configure(logger_factory=LoggerFactory())
LOGGER = structlog.getLogger(__name__)
+TASK_ID_EXPANSION = "task_id"
EVERGREEN_FILE = "etc/evergreen.yml"
EVG_CONFIG_FILE = ".evergreen.yml"
EXTERNAL_LOGGERS = {
@@ -407,7 +410,9 @@ def run(evg_api: EvergreenApi, evg_conf: EvergreenProjectConfig,
"""
config_dict_of_suites_and_tasks = {}
- changed_files = find_changed_files_in_repos(repos)
+ task_id = selected_tests_variant_expansions[TASK_ID_EXPANSION]
+ revision_map = generate_revision_map_from_manifest(repos, task_id, evg_api)
+ changed_files = find_changed_files_in_repos(repos, revision_map)
changed_files = {_remove_repo_path_prefix(file_path) for file_path in changed_files}
LOGGER.debug("Found changed files", files=changed_files)
diff --git a/buildscripts/tests/patch_builds/test_change_data.py b/buildscripts/tests/patch_builds/test_change_data.py
new file mode 100644
index 00000000000..531dea65569
--- /dev/null
+++ b/buildscripts/tests/patch_builds/test_change_data.py
@@ -0,0 +1,91 @@
+"""Unit tests for buildscripts.patch_builds.change_data.py."""
+from __future__ import absolute_import
+
+import os
+import unittest
+
+from mock import patch, MagicMock
+
+import buildscripts.patch_builds.change_data as under_test
+
+# pylint: disable=missing-docstring
+
+NS = "buildscripts.patch_builds.change_data"
+
+
+def ns(relative_name): # pylint: disable=invalid-name
+ """Return a full name from a name relative to the test module"s name space."""
+ return NS + "." + relative_name
+
+
+def create_mock_repo(working_dir=""):
+ return MagicMock(working_dir=working_dir)
+
+
+class TestFindChangedFilesInRepos(unittest.TestCase):
+ @patch(ns("find_changed_files"))
+ def test_nothing_found(self, changed_files_mock):
+ repos_mock = [MagicMock()]
+ changed_files_mock.return_value = set()
+
+ self.assertEqual(0, len(under_test.find_changed_files_in_repos(repos_mock)))
+
+ @patch(ns("find_changed_files"))
+ def test_changed_files_in_multiple_repos(self, changed_files_mock):
+ repos_mock = [MagicMock(), MagicMock()]
+ first_repo_file_changes = [
+ os.path.join("jstests", "test1.js"),
+ os.path.join("jstests", "test1.cpp"),
+ ]
+ second_repo_file_changes = [
+ os.path.join("jstests", "test2.js"),
+ ]
+ changed_files_mock.side_effect = [first_repo_file_changes, second_repo_file_changes]
+
+ self.assertEqual(3, len(under_test.find_changed_files_in_repos(repos_mock)))
+
+
+class TestGenerateRevisionMap(unittest.TestCase):
+ def test_mongo_revisions_is_mapped_correctly(self):
+ mock_repo_list = [create_mock_repo(os.getcwd()), create_mock_repo("/path/to/enterprise")]
+ revision_data = {"mongo": "revision1234", "enterprise": "revision5678"}
+
+ revision_map = under_test.generate_revision_map(mock_repo_list, revision_data)
+
+ self.assertEqual(revision_map[mock_repo_list[0].git_dir], revision_data["mongo"])
+ self.assertEqual(revision_map[mock_repo_list[1].git_dir], revision_data["enterprise"])
+
+ def test_missing_revisions_are_not_returned(self):
+ mock_repo_list = [create_mock_repo(os.getcwd()), create_mock_repo("/path/to/enterprise")]
+ revision_data = {"mongo": "revision1234"}
+
+ revision_map = under_test.generate_revision_map(mock_repo_list, revision_data)
+
+ self.assertEqual(revision_map[mock_repo_list[0].git_dir], revision_data["mongo"])
+ self.assertEqual(len(revision_map), 1)
+
+ def test_missing_repos_are_not_returned(self):
+ mock_repo_list = [create_mock_repo(os.getcwd())]
+ revision_data = {"mongo": "revision1234", "enterprise": "revision56768"}
+
+ revision_map = under_test.generate_revision_map(mock_repo_list, revision_data)
+
+ self.assertEqual(revision_map[mock_repo_list[0].git_dir], revision_data["mongo"])
+ self.assertEqual(len(revision_map), 1)
+
+
+class TestGenerateRevisionMapFromManifest(unittest.TestCase):
+ def test_map_can_be_created_from_evergreen_api(self):
+ mock_repo_list = [create_mock_repo(os.getcwd()), create_mock_repo("/path/to/enterprise")]
+ mongo_revision = "revision1234"
+ enterprise_revision = "revision5678"
+ mock_manifest = MagicMock(revision=mongo_revision,
+ modules={"enterprise": MagicMock(revision=enterprise_revision)})
+ mock_evg_api = MagicMock()
+ mock_evg_api.manifest_for_task.return_value = mock_manifest
+
+ revision_map = under_test.generate_revision_map_from_manifest(mock_repo_list, "task_id",
+ mock_evg_api)
+
+ self.assertEqual(revision_map[mock_repo_list[0].git_dir], mongo_revision)
+ self.assertEqual(revision_map[mock_repo_list[1].git_dir], enterprise_revision)
diff --git a/buildscripts/tests/test_burn_in_tags.py b/buildscripts/tests/test_burn_in_tags.py
index e6c99d66662..32bddf3c815 100644
--- a/buildscripts/tests/test_burn_in_tags.py
+++ b/buildscripts/tests/test_burn_in_tags.py
@@ -43,6 +43,7 @@ def get_expansions_data():
"repeat_tests_secs": 600,
"revision": "fake_sha",
"project": "fake_project",
+ "task_id": "task id",
} # yapf: disable
@@ -110,7 +111,7 @@ class TestGenerateEvgTasks(unittest.TestCase):
} # yapf: disable
shrub_config = ShrubProject()
evergreen_api = MagicMock()
- repo = MagicMock()
+ repo = MagicMock(working_dir=os.getcwd())
under_test._generate_evg_tasks(evergreen_api, shrub_config, expansions_file_data,
buildvariant_map, [repo], evg_conf_mock)
@@ -136,7 +137,7 @@ class TestGenerateEvgTasks(unittest.TestCase):
} # yapf: disable
shrub_config = ShrubProject.empty()
evergreen_api = MagicMock()
- repo = MagicMock()
+ repo = MagicMock(working_dir=os.getcwd())
evergreen_api.test_stats_by_project.return_value = [
MagicMock(test_file="dir/test2.js", avg_duration_pass=10)
]
@@ -158,7 +159,7 @@ EXPANSIONS_FILE_DATA = {
"revision": "badf00d000000000000000000000000000000000", "max_revisions": "1000",
"branch_name": "mongodb-mongo-master", "is_patch": "false", "distro_id": "rhel62-small",
"repeat_tests_min": "2", "repeat_tests_max": "1000", "repeat_tests_secs": "600", "project":
- "mongodb-mongo-master"
+ "mongodb-mongo-master", "task_id": "task id"
}
CREATE_EVG_BUILD_VARIANT_MAP = {
@@ -210,7 +211,7 @@ class TestAcceptance(unittest.TestCase):
When burn_in_tags is run,
Then no tests are discovered to run.
"""
- repos = [MagicMock()]
+ repos = [MagicMock(working_dir=os.getcwd())]
evg_conf_mock = MagicMock()
find_changed_tests_mock.return_value = {}
@@ -237,7 +238,7 @@ class TestAcceptance(unittest.TestCase):
"""
create_test_membership_map_mock.return_value = defaultdict(list, CREATE_TEST_MEMBERSHIP_MAP)
- repos = [MagicMock()]
+ repos = [MagicMock(working_dir=os.getcwd())]
evg_conf = get_evergreen_config()
create_evg_build_variant_map_mock.return_value = CREATE_EVG_BUILD_VARIANT_MAP
find_changed_tests_mock.return_value = {
diff --git a/buildscripts/tests/test_burn_in_tests.py b/buildscripts/tests/test_burn_in_tests.py
index 523a3c20242..fb89b52e31b 100644
--- a/buildscripts/tests/test_burn_in_tests.py
+++ b/buildscripts/tests/test_burn_in_tests.py
@@ -885,18 +885,3 @@ class TestFindChangedTests(unittest.TestCase):
self.assertIn(file_list[2], found_tests)
self.assertNotIn(file_list[1], found_tests)
self.assertEqual(2, len(found_tests))
-
-
-class TestGetRevisionMap(unittest.TestCase):
- def test_get_revision_map(self):
- repos = [
- MagicMock(git_dir="/mongo/.git", working_dir="/mongo"),
- MagicMock(git_dir="/enterprise/.git", working_dir="/enterprise")
- ]
- revision_map = under_test.get_revision_map(repos, "sha")
- assert revision_map == {"/mongo/.git": "sha"}
-
- def test_no_mongo_repo(self):
- repos = [MagicMock(git_dir="/enterprise/.git", working_dir="/enterprise")]
- with self.assertRaises(Exception):
- under_test.get_revision_map(repos, "sha")
diff --git a/buildscripts/tests/test_change_data.py b/buildscripts/tests/test_change_data.py
deleted file mode 100644
index a41af313089..00000000000
--- a/buildscripts/tests/test_change_data.py
+++ /dev/null
@@ -1,42 +0,0 @@
-"""Unit tests for buildscripts.patch_builds.change_data.py."""
-
-from __future__ import absolute_import
-
-import os
-import unittest
-
-from mock import patch, MagicMock
-
-import buildscripts.patch_builds.change_data as under_test
-
-# pylint: disable=missing-docstring
-
-NS = "buildscripts.patch_builds.change_data"
-
-
-def ns(relative_name): # pylint: disable=invalid-name
- """Return a full name from a name relative to the test module"s name space."""
- return NS + "." + relative_name
-
-
-class TestFindChangedFilesInRepos(unittest.TestCase):
- @patch(ns("find_changed_files"))
- def test_nothing_found(self, changed_files_mock):
- repos_mock = [MagicMock()]
- changed_files_mock.return_value = set()
-
- self.assertEqual(0, len(under_test.find_changed_files_in_repos(repos_mock)))
-
- @patch(ns("find_changed_files"))
- def test_changed_files_in_multiple_repos(self, changed_files_mock):
- repos_mock = [MagicMock(), MagicMock()]
- first_repo_file_changes = [
- os.path.join("jstests", "test1.js"),
- os.path.join("jstests", "test1.cpp"),
- ]
- second_repo_file_changes = [
- os.path.join("jstests", "test2.js"),
- ]
- changed_files_mock.side_effect = [first_repo_file_changes, second_repo_file_changes]
-
- self.assertEqual(3, len(under_test.find_changed_files_in_repos(repos_mock)))
diff --git a/buildscripts/tests/test_selected_tests.py b/buildscripts/tests/test_selected_tests.py
index 7d76e728410..2d3ccd60645 100644
--- a/buildscripts/tests/test_selected_tests.py
+++ b/buildscripts/tests/test_selected_tests.py
@@ -72,7 +72,8 @@ class TestAcceptance(unittest.TestCase):
selected_tests_service_mock.get_test_mappings.return_value = []
selected_tests_variant_expansions = {
"task_name": "selected_tests_gen", "build_variant": "selected-tests",
- "build_id": "my_build_id", "project": "mongodb-mongo-master"
+ "build_id": "my_build_id", "project": "mongodb-mongo-master",
+ "version_id": "my_version", "task_id": "task_id"
}
repos = [mock_changed_git_files([])]
origin_build_variants = ["enterprise-rhel-62-64-bit"]
@@ -98,7 +99,8 @@ class TestAcceptance(unittest.TestCase):
]
selected_tests_variant_expansions = {
"task_name": "selected_tests_gen", "build_variant": "selected-tests",
- "build_id": "my_build_id", "project": "mongodb-mongo-master"
+ "build_id": "my_build_id", "project": "mongodb-mongo-master",
+ "version_id": "my_version", "task_id": "task_id"
}
repos = [mock_changed_git_files(["src/file1.cpp"])]
origin_build_variants = ["enterprise-rhel-62-64-bit"]
@@ -132,7 +134,8 @@ class TestAcceptance(unittest.TestCase):
]
selected_tests_variant_expansions = {
"task_name": "selected_tests_gen", "build_variant": "selected-tests",
- "build_id": "my_build_id", "project": "mongodb-mongo-master"
+ "build_id": "my_build_id", "project": "mongodb-mongo-master",
+ "version_id": "my_version", "task_id": "task id"
}
repos = [mock_changed_git_files(["src/file1.cpp"])]
origin_build_variants = ["enterprise-rhel-62-64-bit"]