2018-03-27 14:30:46 -04:00
|
|
|
"""The unittest.TestCase for C++ integration tests."""
|
2017-06-14 20:44:52 -04:00
|
|
|
|
2025-08-26 15:42:07 -04:00
|
|
|
import copy
|
2024-05-14 11:07:04 -07:00
|
|
|
from typing import Optional
|
2024-10-10 10:59:18 -07:00
|
|
|
|
2024-05-14 11:07:04 -07:00
|
|
|
from buildscripts.resmokelib import core, logging, utils
|
2020-06-17 17:41:54 +03:00
|
|
|
from buildscripts.resmokelib.testing.testcases import interface
|
2026-01-28 12:22:51 -05:00
|
|
|
from buildscripts.resmokelib.utils import certs
|
2017-06-14 20:44:52 -04:00
|
|
|
|
|
|
|
|
|
2018-03-06 16:28:23 -05:00
|
|
|
class CPPIntegrationTestCase(interface.ProcessTestCase):
|
2018-03-27 14:30:46 -04:00
|
|
|
"""A C++ integration test to execute."""
|
2017-06-14 20:44:52 -04:00
|
|
|
|
|
|
|
|
REGISTERED_NAME = "cpp_integration_test"
|
|
|
|
|
|
2024-05-16 18:00:17 -04:00
|
|
|
def __init__(
|
|
|
|
|
self,
|
|
|
|
|
logger: logging.Logger,
|
|
|
|
|
program_executables: list[str],
|
|
|
|
|
program_options: Optional[dict] = None,
|
|
|
|
|
):
|
2018-03-27 14:30:46 -04:00
|
|
|
"""Initialize the CPPIntegrationTestCase with the executable to run."""
|
2017-06-14 20:44:52 -04:00
|
|
|
|
2024-05-14 11:07:04 -07:00
|
|
|
assert len(program_executables) == 1
|
2024-05-16 18:00:17 -04:00
|
|
|
interface.ProcessTestCase.__init__(
|
|
|
|
|
self, logger, "C++ integration test", program_executables[0]
|
|
|
|
|
)
|
2017-06-14 20:44:52 -04:00
|
|
|
|
2024-05-14 11:07:04 -07:00
|
|
|
self.program_executable = program_executables[0]
|
2017-06-14 20:44:52 -04:00
|
|
|
self.program_options = utils.default_if_none(program_options, {}).copy()
|
|
|
|
|
|
|
|
|
|
def configure(self, fixture, *args, **kwargs):
|
2018-03-27 14:30:46 -04:00
|
|
|
"""Configure the test case."""
|
2018-03-07 11:54:58 -05:00
|
|
|
interface.ProcessTestCase.configure(self, fixture, *args, **kwargs)
|
2017-06-14 20:44:52 -04:00
|
|
|
|
2025-02-20 16:28:32 -05:00
|
|
|
self.program_options["connectionString"] = self.fixture.get_shell_connection_string(
|
|
|
|
|
self.program_options.get("useEgressGRPC")
|
|
|
|
|
)
|
2017-06-14 20:44:52 -04:00
|
|
|
|
2025-08-26 15:42:07 -04:00
|
|
|
process_kwargs = copy.deepcopy(self.program_options.get("process_kwargs", {}))
|
|
|
|
|
interface.append_process_tracking_options(process_kwargs, self._id)
|
|
|
|
|
self.program_options["process_kwargs"] = process_kwargs
|
2026-01-28 12:22:51 -05:00
|
|
|
self.program_options = certs.expand_x509_paths(self.program_options)
|
2025-08-26 15:42:07 -04:00
|
|
|
|
2017-06-14 20:44:52 -04:00
|
|
|
def _make_process(self):
|
2024-05-16 18:00:17 -04:00
|
|
|
return core.programs.generic_program(
|
2025-12-29 17:16:30 -05:00
|
|
|
self.logger,
|
|
|
|
|
[self.program_executable, "--enhancedReporter=false"],
|
|
|
|
|
**self.program_options,
|
2024-05-16 18:00:17 -04:00
|
|
|
)
|