diff options
author | jannaerin <golden.janna@gmail.com> | 2020-04-21 13:51:15 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-24 16:10:48 +0000 |
commit | 76823e76d597b52e66539580474c93be02fe2c6e (patch) | |
tree | bf95197be18b9b677adda6aa4c79bbe851a17511 /buildscripts | |
parent | 9ccfe0715fd23452c285471322529da8adec86e2 (diff) | |
download | mongo-76823e76d597b52e66539580474c93be02fe2c6e.tar.gz |
SERVER-43333 Ingest drivers server selection tests
Diffstat (limited to 'buildscripts')
5 files changed, 59 insertions, 2 deletions
diff --git a/buildscripts/resmokeconfig/suites/sdam_json_test.yml b/buildscripts/resmokeconfig/suites/sdam_json_test.yml index f45af248956..0c55c0256b8 100644 --- a/buildscripts/resmokeconfig/suites/sdam_json_test.yml +++ b/buildscripts/resmokeconfig/suites/sdam_json_test.yml @@ -2,6 +2,6 @@ test_kind: sdam_json_test selector: roots: - - src/mongo/client/sdam/json_tests/**/*.json + - src/mongo/client/sdam/json_tests/sdam_tests/**/*.json executor: {} diff --git a/buildscripts/resmokeconfig/suites/server_selection_json_test.yml b/buildscripts/resmokeconfig/suites/server_selection_json_test.yml new file mode 100644 index 00000000000..77c0710cef5 --- /dev/null +++ b/buildscripts/resmokeconfig/suites/server_selection_json_test.yml @@ -0,0 +1,7 @@ +test_kind: server_selection_json_test + +selector: + roots: + - src/mongo/client/sdam/json_tests/server_selection_tests/**/*.json + +executor: {} diff --git a/buildscripts/resmokelib/selector.py b/buildscripts/resmokelib/selector.py index 3af154b951d..98f9b0f1474 100644 --- a/buildscripts/resmokelib/selector.py +++ b/buildscripts/resmokelib/selector.py @@ -694,6 +694,7 @@ _SELECTOR_REGISTRY = { "cpp_unit_test": (_CppTestSelectorConfig, _CppTestSelector), "benchmark_test": (_CppTestSelectorConfig, _CppTestSelector), "sdam_json_test": (_FileBasedSelectorConfig, _Selector), + "server_selection_json_test": (_FileBasedSelectorConfig, _Selector), "db_test": (_DbTestSelectorConfig, _DbTestSelector), "fsm_workload_test": (_JSTestSelectorConfig, _JSTestSelector), "parallel_fsm_workload_test": (_MultiJSTestSelectorConfig, _MultiJSTestSelector), diff --git a/buildscripts/resmokelib/testing/testcases/sdam_json_test.py b/buildscripts/resmokelib/testing/testcases/sdam_json_test.py index 19d364c15d5..d998423803f 100644 --- a/buildscripts/resmokelib/testing/testcases/sdam_json_test.py +++ b/buildscripts/resmokelib/testing/testcases/sdam_json_test.py @@ -14,7 +14,7 @@ class SDAMJsonTestCase(interface.ProcessTestCase): REGISTERED_NAME = "sdam_json_test" EXECUTABLE_BUILD_PATH = "build/**/mongo/client/sdam/sdam_json_test" - TEST_DIR = os.path.normpath("src/mongo/client/sdam/json_tests") + TEST_DIR = os.path.normpath("src/mongo/client/sdam/json_tests/sdam_tests") def __init__(self, logger, json_test_file, program_options=None): """Initialize the TestCase with the executable to run.""" diff --git a/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py b/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py new file mode 100644 index 00000000000..9a739ae5740 --- /dev/null +++ b/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py @@ -0,0 +1,49 @@ +"""The unittest.TestCase for Server Selection JSON tests.""" +import os +import os.path +from . import interface +from ... import core +from ... import config +from ... import utils +from ...utils import globstar +from ... import errors + + +class ServerSelectionJsonTestCase(interface.ProcessTestCase): + """Server Selection JSON test case.""" + + REGISTERED_NAME = "server_selection_json_test" + EXECUTABLE_BUILD_PATH = "build/**/mongo/client/sdam/server_selection_json_test" + TEST_DIR = os.path.normpath("src/mongo/client/sdam/json_tests/server_selection_tests") + + def __init__(self, logger, json_test_file, program_options=None): + """Initialize the TestCase with the executable to run.""" + interface.ProcessTestCase.__init__(self, logger, "Server Selection Json Test", + json_test_file) + + self.program_executable = self._find_executable() + self.json_test_file = os.path.normpath(json_test_file) + self.program_options = utils.default_if_none(program_options, {}).copy() + + def _find_executable(self): + if config.INSTALL_DIR is not None: + binary = os.path.join(config.INSTALL_DIR, "server_selection_json_test") + if os.name == "nt": + binary += ".exe" + + if os.path.isfile(binary): + return binary + + execs = globstar.glob(self.EXECUTABLE_BUILD_PATH + '.exe') + if not execs: + execs = globstar.glob(self.EXECUTABLE_BUILD_PATH) + if len(execs) != 1: + raise errors.StopExecution( + "There must be a single server_selection_json_test binary in {}".format(execs)) + return execs[0] + + def _make_process(self): + command_line = [self.program_executable] + command_line += ["--source-dir", self.TEST_DIR] + command_line += ["-f", self.json_test_file] + return core.programs.make_process(self.logger, command_line) |