0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-27 23:27:11 +01:00

SERVER-96676 Added QueryTester self tests to resmoke (#28419)

GitOrigin-RevId: f6fd7eee10d63d3cdf6d320d8b9a2530c1940d7d
This commit is contained in:
Naafiyan Ahmed 2024-11-04 16:13:53 -05:00 committed by MongoDB Bot
parent 7007cfa701
commit eeb14cc1bd
4 changed files with 49 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -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),
}

View File

@ -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,
],
)