diff --git a/buildscripts/resmokeconfig/suites/query_tester_self_test.yml b/buildscripts/resmokeconfig/suites/query_tester_self_test.yml new file mode 100644 index 00000000000..177c57b63bf --- /dev/null +++ b/buildscripts/resmokeconfig/suites/query_tester_self_test.yml @@ -0,0 +1,11 @@ +test_kind: query_tester_self_test +# This suite will test that QueryTester and its mongotest binary which is a tool for testing the server works as expected. +# Each test might pass different flags to mongotest, check its return code, output, and/or filesystem changes. + +selector: + roots: + - src/mongo/db/modules/QueryTester/tests/selfTests/*.py + +executor: + fixture: + class: MongoDFixture diff --git a/buildscripts/resmokelib/config.py b/buildscripts/resmokelib/config.py index 69177d980e3..aa41ec9536b 100644 --- a/buildscripts/resmokelib/config.py +++ b/buildscripts/resmokelib/config.py @@ -30,6 +30,7 @@ DEFAULT_MONGO_EXECUTABLE = "mongo" DEFAULT_MONGOD_EXECUTABLE = "mongod" DEFAULT_MONGOS_EXECUTABLE = "mongos" DEFAULT_MONGOT_EXECUTABLE = "mongot-localdev/mongot" +DEFAULT_MONGOTEST_EXECUTABLE = "mongotest" DEFAULT_BENCHMARK_REPETITIONS = 3 DEFAULT_BENCHMARK_MIN_TIME = datetime.timedelta(seconds=5) diff --git a/buildscripts/resmokelib/selector.py b/buildscripts/resmokelib/selector.py index cceeb3d49e2..a330ae8272a 100644 --- a/buildscripts/resmokelib/selector.py +++ b/buildscripts/resmokelib/selector.py @@ -906,6 +906,7 @@ _SELECTOR_REGISTRY = { "tla_plus_test": (_FileBasedSelectorConfig, _Selector), "bulk_write_cluster_js_test": (_JSTestSelectorConfig, _JSTestSelector), "magic_restore_js_test": (_JSTestSelectorConfig, _JSTestSelector), + "query_tester_self_test": (_FileBasedSelectorConfig, _Selector), } diff --git a/buildscripts/resmokelib/testing/testcases/query_tester_self_test.py b/buildscripts/resmokelib/testing/testcases/query_tester_self_test.py new file mode 100644 index 00000000000..ca46f863e2e --- /dev/null +++ b/buildscripts/resmokelib/testing/testcases/query_tester_self_test.py @@ -0,0 +1,36 @@ +"""The unittest.TestCase for QueryTester self-tests.""" + +import sys + +from buildscripts.resmokelib import config as _config +from buildscripts.resmokelib import core, logging +from buildscripts.resmokelib.testing.testcases import interface + + +class QueryTesterSelfTestCase(interface.ProcessTestCase): + """A QueryTester self-test to execute.""" + + REGISTERED_NAME = "query_tester_self_test" + + def __init__(self, logger: logging.Logger, test_filenames: list[str]): + """Initialize QueryTesterSelfTestCase. + + test_filenames must contain one test_file - a python file that takes one argument: the uri of the mongod. + To run multiple test files, you would create an instance of QueryTesterSelfTestCase for each one. + """ + assert len(test_filenames) == 1 + interface.ProcessTestCase.__init__(self, logger, "QueryTesterSelfTest", test_filenames[0]) + self.test_file = test_filenames[0] + + def _make_process(self): + return core.programs.generic_program( + self.logger, + [ + sys.executable, + self.test_file, + "-u", + self.fixture.get_internal_connection_string(), + "-b", + _config.DEFAULT_MONGOTEST_EXECUTABLE, + ], + )