From 2f827bb2600ec5fecac341e5e9f99363667de15d Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 6 Jan 2026 22:06:26 +0000 Subject: [PATCH 1/8] Implement modular approach. --- integration-tests/.pytest.ini | 11 ++- integration-tests/tests/conftest.py | 2 +- .../tests/fixtures/package_instance.py | 20 +++--- ...ckage_config.py => package_test_config.py} | 35 ++++------ .../tests/package_tests/clp_json/__init__.py | 1 + .../datasets/json-multifile/README.md | 19 +++++ .../logs/sts-135-2011-07-08.jsonl | 8 +++ .../logs/sts-135-2011-07-09.jsonl | 8 +++ .../logs/sts-135-2011-07-11.jsonl | 8 +++ .../logs/sts-135-2011-07-19.jsonl | 8 +++ .../logs/sts-135-2011-07-21.jsonl | 8 +++ .../package_tests/clp_json/test_clp_json.py | 69 +++++++++++++++++++ .../tests/package_tests/clp_text/__init__.py | 1 + .../package_tests/clp_text/test_clp_text.py | 53 ++++++++++++++ integration-tests/tests/test_package_start.py | 27 -------- .../tests/utils/asserting_utils.py | 27 ++++++-- .../tests/utils/clp_mode_utils.py | 55 +-------------- integration-tests/tests/utils/config.py | 45 +++++++----- .../tests/utils/package_utils.py | 18 ++--- 19 files changed, 276 insertions(+), 147 deletions(-) rename integration-tests/tests/fixtures/{package_config.py => package_test_config.py} (51%) create mode 100644 integration-tests/tests/package_tests/clp_json/__init__.py create mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md create mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl create mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl create mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl create mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl create mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl create mode 100644 integration-tests/tests/package_tests/clp_json/test_clp_json.py create mode 100644 integration-tests/tests/package_tests/clp_text/__init__.py create mode 100644 integration-tests/tests/package_tests/clp_text/test_clp_text.py delete mode 100644 integration-tests/tests/test_package_start.py diff --git a/integration-tests/.pytest.ini b/integration-tests/.pytest.ini index 07fb7b9ee4..dc35b66a2f 100644 --- a/integration-tests/.pytest.ini +++ b/integration-tests/.pytest.ini @@ -1,9 +1,9 @@ [pytest] addopts = - --capture=no + ; --capture=no --code-highlight=yes --color=yes - -rA + ; -rA --strict-config --strict-markers --verbose @@ -17,6 +17,11 @@ log_cli_format = %(name)s %(asctime)s [%(levelname)s] %(message)s log_cli_level = INFO markers = clp: mark tests that use the CLP storage engine + clp_json: mark tests that use the clp-json package clp_s: mark tests that use the CLP-S storage engine + clp_text: mark tests that use the clp-text package + compression: mark tests that test compression core: mark tests that test the CLP core binaries - package: mark tests that run when the CLP package is active + package: mark tests that use the CLP package + search: search tests + startup: mark tests that test startup diff --git a/integration-tests/tests/conftest.py b/integration-tests/tests/conftest.py index c1af599c98..1741453b3a 100644 --- a/integration-tests/tests/conftest.py +++ b/integration-tests/tests/conftest.py @@ -7,7 +7,7 @@ "tests.fixtures.integration_test_logs", "tests.fixtures.path_configs", "tests.fixtures.package_instance", - "tests.fixtures.package_config", + "tests.fixtures.package_test_config", ] diff --git a/integration-tests/tests/fixtures/package_instance.py b/integration-tests/tests/fixtures/package_instance.py index b2ea7ef4b3..a3aaf9cf4c 100644 --- a/integration-tests/tests/fixtures/package_instance.py +++ b/integration-tests/tests/fixtures/package_instance.py @@ -5,8 +5,8 @@ import pytest from tests.utils.config import ( - PackageConfig, PackageInstance, + PackageTestConfig, ) from tests.utils.package_utils import ( start_clp_package, @@ -14,26 +14,26 @@ ) -@pytest.fixture -def fixt_package_instance(fixt_package_config: PackageConfig) -> Iterator[PackageInstance]: +@pytest.fixture(scope="module") +def fixt_package_instance(fixt_package_test_config: PackageTestConfig) -> Iterator[PackageInstance]: """ Starts a CLP package instance for the given configuration and stops it during teardown. - :param fixt_package_config: + :param fixt_package_test_config: :return: Iterator that yields the running package instance. """ - mode_name = fixt_package_config.mode_name - try: - start_clp_package(fixt_package_config) - instance = PackageInstance(package_config=fixt_package_config) + start_clp_package(fixt_package_test_config) + instance = PackageInstance(package_test_config=fixt_package_test_config) yield instance except RuntimeError: - base_port = fixt_package_config.base_port + mode_config = fixt_package_test_config.mode_config + mode_name = mode_config.mode_name + base_port = fixt_package_test_config.base_port pytest.fail( f"Failed to start the {mode_name} package. This could mean that one of the ports" f" derived from base_port={base_port} was unavailable. You can specify a new value for" " base_port with the '--base-port' flag." ) finally: - stop_clp_package(fixt_package_config) + stop_clp_package(fixt_package_test_config) diff --git a/integration-tests/tests/fixtures/package_config.py b/integration-tests/tests/fixtures/package_test_config.py similarity index 51% rename from integration-tests/tests/fixtures/package_config.py rename to integration-tests/tests/fixtures/package_test_config.py index 8db533dcf2..4f33c0a7db 100644 --- a/integration-tests/tests/fixtures/package_config.py +++ b/integration-tests/tests/fixtures/package_test_config.py @@ -4,29 +4,24 @@ import pytest -from tests.utils.clp_mode_utils import ( - get_clp_config_from_mode, - get_required_component_list, -) -from tests.utils.config import PackageConfig, PackagePathConfig +from tests.utils.config import PackageModeConfig, PackagePathConfig, PackageTestConfig from tests.utils.port_utils import assign_ports_from_base -@pytest.fixture -def fixt_package_config( +@pytest.fixture(scope="module") +def fixt_package_test_config( request: pytest.FixtureRequest, fixt_package_path_config: PackagePathConfig, -) -> Iterator[PackageConfig]: +) -> Iterator[PackageTestConfig]: """ - Creates and maintains a PackageConfig object for a specific CLP mode. + Creates and maintains a PackageTestConfig object for a specific CLP mode. :param request: - :return: An iterator that yields the PackageConfig object for the specified mode. + :return: An iterator that yields the PackageTestConfig object for the specified mode. :raise ValueError: if the CLP base port's value is invalid. """ - mode_name: str = request.param - - clp_config_obj = get_clp_config_from_mode(mode_name) + mode_config: PackageModeConfig = request.param + clp_config_obj = mode_config.clp_config # Assign ports based on the clp base port CLI option. base_port_string = request.config.getoption("--base-port") @@ -37,18 +32,14 @@ def fixt_package_config( raise ValueError(err_msg) from err assign_ports_from_base(base_port, clp_config_obj) - required_components = get_required_component_list(clp_config_obj) - - # Construct PackageConfig. - package_config = PackageConfig( + # Construct PackageTestConfig. + package_test_config = PackageTestConfig( path_config=fixt_package_path_config, - mode_name=mode_name, - component_list=required_components, - clp_config=clp_config_obj, + mode_config=mode_config, base_port=base_port, ) try: - yield package_config + yield package_test_config finally: - package_config.temp_config_file_path.unlink(missing_ok=True) + package_test_config.temp_config_file_path.unlink(missing_ok=True) diff --git a/integration-tests/tests/package_tests/clp_json/__init__.py b/integration-tests/tests/package_tests/clp_json/__init__.py new file mode 100644 index 0000000000..3a36260bc8 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/__init__.py @@ -0,0 +1 @@ +"""Top-level package for clp-json package integration tests.""" diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md new file mode 100644 index 0000000000..3ecb69da25 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md @@ -0,0 +1,19 @@ +# Description of logs + +**Type** +JSONL + +**Number of files** +5 + +**Number of events per file** +8 + +**Beginning timestamp (milliseconds)** +1310138944000 + +**End timestamp (milliseconds)** +1311208074120 + +**Authoritative timestamp*** +timestamp diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl new file mode 100644 index 0000000000..1ba45d0ec1 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl @@ -0,0 +1,8 @@ +{"timestamp":1310138944000,"mission":"STS-135","mission_day_index":0,"event":"SRB_IGNITION_CONFIRMED","subsystem":"PROP","level":"INFO","detail":"Solid rocket boosters report stable ignition and rising thrust","line_index":0} +{"timestamp":1310139148373,"mission":"STS-135","mission_day_index":0,"event":"CLEAR_OF_TOWER","subsystem":"GUIDANCE","level":"INFO","detail":"Vehicle cleared tower, roll program initiated, tracking nominal trajectory","line_index":1} +{"timestamp":1310139352746,"mission":"STS-135","mission_day_index":0,"event":"ROLL_PROGRAM_COMPLETE","subsystem":"GUIDANCE","level":"INFO","detail":"Roll program complete, heads down attitude achieved for ascent","line_index":2} +{"timestamp":1310139557119,"mission":"STS-135","mission_day_index":0,"event":"MAX_Q_THROTTLE","subsystem":"PROP","level":"INFO","detail":"Main engines throttled to manage maximum dynamic pressure on stack","line_index":3} +{"timestamp":1310139761493,"mission":"STS-135","mission_day_index":0,"event":"SRB_SEPARATION","subsystem":"PROP","level":"INFO","detail":"Solid rocket boosters separation confirmed, separation motors firing nominally","line_index":4} +{"timestamp":1310139965866,"mission":"STS-135","mission_day_index":0,"event":"PRESS_TO_MECO","subsystem":"GUIDANCE","level":"INFO","detail":"Performance marks indicate press to main engine cutoff achieved","line_index":5} +{"timestamp":1310140170239,"mission":"STS-135","mission_day_index":0,"event":"MAIN_ENGINE_CUTOFF","subsystem":"PROP","level":"INFO","detail":"All three SSME engines shutdown, engine parameters within expected bands","line_index":6} +{"timestamp":1310140374613,"mission":"STS-135","mission_day_index":0,"event":"EXTERNAL_TANK_SEPARATION","subsystem":"STRUCTURES","level":"INFO","detail":"External tank separation command executed, umbilical disconnect nominal","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl new file mode 100644 index 0000000000..89650afd46 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl @@ -0,0 +1,8 @@ +{"timestamp":1310169600000,"mission":"STS-135","mission_day_index":1,"event":"RNDZ_BURN","subsystem":"GUIDANCE","level":"INFO","detail":"Rendezvous correction burn complete, relative motion profile matches ISS plan","line_index":0} +{"timestamp":1310170175999,"mission":"STS-135","mission_day_index":1,"event":"RPM_MANEUVER","subsystem":"GUIDANCE","level":"INFO","detail":"R bar pitch maneuver complete for station imaging and TPS assessment","line_index":1} +{"timestamp":1310170751999,"mission":"STS-135","mission_day_index":1,"event":"FINAL_APPROACH","subsystem":"GUIDANCE","level":"INFO","detail":"Final approach corridor maintained, closing rate within docking constraints","line_index":2} +{"timestamp":1310171327999,"mission":"STS-135","mission_day_index":1,"event":"SOFT_DOCK","subsystem":"DOCKING","level":"INFO","detail":"Soft capture confirmed at forward port, relative motion damped","line_index":3} +{"timestamp":1310171903999,"mission":"STS-135","mission_day_index":1,"event":"HARD_DOCK","subsystem":"DOCKING","level":"INFO","detail":"Structural latches engaged, ISS and shuttle in hard dock configuration","line_index":4} +{"timestamp":1310172479999,"mission":"STS-135","mission_day_index":1,"event":"HATCH_OPEN","subsystem":"STRUCTURES","level":"INFO","detail":"Hatch open for ingress, pressure equalization verified within safe band","line_index":5} +{"timestamp":1310173055999,"mission":"STS-135","mission_day_index":1,"event":"MPLM_BERTHING","subsystem":"ROBOTICS","level":"INFO","detail":"Multipurpose logistics module berthed to Node, structural attach points verified","line_index":6} +{"timestamp":1310173631999,"mission":"STS-135","mission_day_index":1,"event":"CARGO_TRANSFER","subsystem":"PAYLOAD","level":"INFO","detail":"Cargo transfer underway according to integrated ISS and shuttle transfer list","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl new file mode 100644 index 0000000000..cdbabf0945 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl @@ -0,0 +1,8 @@ +{"timestamp":1310342400000,"mission":"STS-135","mission_day_index":3,"event":"JOINT_OPERATIONS_PLANNING","subsystem":"TIMELINE","level":"INFO","detail":"Daily planning conference complete, joint tasks synchronized","line_index":0} +{"timestamp":1310342975999,"mission":"STS-135","mission_day_index":3,"event":"EVA_PREP","subsystem":"EVA","level":"INFO","detail":"Extravehicular mobility units serviced, prebreathe protocols initiated","line_index":1} +{"timestamp":1310343551999,"mission":"STS-135","mission_day_index":3,"event":"EVA_TASK_STATUS","subsystem":"EVA","level":"INFO","detail":"Truss and payload bay tasks progressing, consumables within expected usage","line_index":2} +{"timestamp":1310344127999,"mission":"STS-135","mission_day_index":3,"event":"MPLM_UNBERTH","subsystem":"ROBOTICS","level":"INFO","detail":"Logistics module unberthed and reinstalled in payload bay","line_index":3} +{"timestamp":1310344703999,"mission":"STS-135","mission_day_index":3,"event":"ISS_SYSTEMS_HANDOFF","subsystem":"COMMS","level":"INFO","detail":"Command and telemetry handoff between shuttle and station completed","line_index":4} +{"timestamp":1310345279999,"mission":"STS-135","mission_day_index":3,"event":"MIDDECK_PAYLOAD_CHECK","subsystem":"PAYLOAD","level":"INFO","detail":"Middeck experiment racks powered and data recording verified","line_index":5} +{"timestamp":1310345855999,"mission":"STS-135","mission_day_index":3,"event":"ENVIRONMENTAL_MONITORING","subsystem":"ECLSS","level":"INFO","detail":"Atmospheric sampling shows stable CO2 and trace contaminant levels","line_index":6} +{"timestamp":1310346431999,"mission":"STS-135","mission_day_index":3,"event":"JOINT_CREW_MEETING","subsystem":"TIMELINE","level":"INFO","detail":"Joint crew status review completed, no blocking issues reported","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl new file mode 100644 index 0000000000..c60ff4341a --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl @@ -0,0 +1,8 @@ +{"timestamp":1311033600000,"mission":"STS-135","mission_day_index":11,"event":"UNDOCK_COMMAND","subsystem":"DOCKING","level":"INFO","detail":"Undock command executed, structural latches release verified","line_index":0} +{"timestamp":1311034175999,"mission":"STS-135","mission_day_index":11,"event":"SEPARATION_BURNS","subsystem":"GUIDANCE","level":"INFO","detail":"Separation maneuvers complete, increasing range rate from station","line_index":1} +{"timestamp":1311034751999,"mission":"STS-135","mission_day_index":11,"event":"TPS_INSPECTION","subsystem":"THERMAL","level":"INFO","detail":"Thermal protection system sensor data and imagery show no critical damage","line_index":2} +{"timestamp":1311035327999,"mission":"STS-135","mission_day_index":11,"event":"DEORBIT_BURN","subsystem":"PROP","level":"INFO","detail":"Deorbit burn complete, entry interface conditions within design envelope","line_index":3} +{"timestamp":1311035903999,"mission":"STS-135","mission_day_index":11,"event":"ENTRY_INTERFACE","subsystem":"GUIDANCE","level":"INFO","detail":"Vehicle at entry interface, guidance following nominal drag corridor","line_index":4} +{"timestamp":1311036479999,"mission":"STS-135","mission_day_index":11,"event":"COMM_BLACKOUT","subsystem":"COMMS","level":"INFO","detail":"Expected communications blackout region entered, tracking via ground radar only","line_index":5} +{"timestamp":1311037055999,"mission":"STS-135","mission_day_index":11,"event":"SUBSONIC_TRANSITION","subsystem":"GUIDANCE","level":"INFO","detail":"Shuttle transitions to subsonic flight, control surfaces active","line_index":6} +{"timestamp":1311037631999,"mission":"STS-135","mission_day_index":11,"event":"WHEELS_STOP","subsystem":"TIMELINE","level":"INFO","detail":"Vehicle stopped on runway, rollout distance within predicted range","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl new file mode 100644 index 0000000000..f2b7aa9ec8 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl @@ -0,0 +1,8 @@ +{"timestamp":1311206400000,"mission":"STS-135","mission_day_index":13,"event":"PAYLOAD_UNLOAD","subsystem":"PAYLOAD","level":"INFO","detail":"Post flight payload processing under way, canisters removed from bay","line_index":0} +{"timestamp":1311206639160,"mission":"STS-135","mission_day_index":13,"event":"VEHICLE_SAFE","subsystem":"GROUND","level":"INFO","detail":"Hazardous systems safed, access teams cleared for orbiter entry","line_index":1} +{"timestamp":1311206878320,"mission":"STS-135","mission_day_index":13,"event":"DATA_ARCHIVE","subsystem":"GROUND","level":"INFO","detail":"Flight data downlinked and archived for post mission analysis","line_index":2} +{"timestamp":1311207117480,"mission":"STS-135","mission_day_index":13,"event":"CREW_DEBRIEF","subsystem":"TIMELINE","level":"INFO","detail":"Crew debrief with mission control completed without anomalies","line_index":3} +{"timestamp":1311207356640,"mission":"STS-135","mission_day_index":13,"event":"VEHICLE_TOW","subsystem":"GROUND","level":"INFO","detail":"Atlantis towed from runway to Orbiter Processing Facility","line_index":4} +{"timestamp":1311207595800,"mission":"STS-135","mission_day_index":13,"event":"RETIREMENT_CONFIG","subsystem":"GROUND","level":"INFO","detail":"Systems configured for extended safe power down and display conversion","line_index":5} +{"timestamp":1311207834960,"mission":"STS-135","mission_day_index":13,"event":"PUBLIC_EVENT","subsystem":"OUTREACH","level":"INFO","detail":"Crew participates in public event describing program closeout activities","line_index":6} +{"timestamp":1311208074120,"mission":"STS-135","mission_day_index":13,"event":"HARDWARE_REUSE_ASSESSMENT","subsystem":"ENGINEERING","level":"INFO","detail":"Component assessments identify candidates for museum display","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/test_clp_json.py b/integration-tests/tests/package_tests/clp_json/test_clp_json.py new file mode 100644 index 0000000000..5f7d6a3a33 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_json/test_clp_json.py @@ -0,0 +1,69 @@ +"""Tests for the clp-json package.""" + +import logging + +import pytest +from clp_py_utils.clp_config import ( + ClpConfig, + Package, + QueryEngine, + StorageEngine, +) + +from tests.utils.asserting_utils import ( + validate_package_instance, +) +from tests.utils.clp_mode_utils import CLP_API_SERVER_COMPONENT, CLP_BASE_COMPONENTS +from tests.utils.config import PackageInstance, PackageModeConfig + +logger = logging.getLogger(__name__) + + +# Mode description for this module. +CLP_JSON_MODE = PackageModeConfig( + mode_name="clp-json", + clp_config=ClpConfig( + package=Package( + storage_engine=StorageEngine.CLP_S, + query_engine=QueryEngine.CLP_S, + ), + ), + component_list=[*CLP_BASE_COMPONENTS, CLP_API_SERVER_COMPONENT], +) + + +# Pytest markers for this module. +pytestmark = [ + pytest.mark.package, + pytest.mark.clp_json, + pytest.mark.parametrize("fixt_package_test_config", [CLP_JSON_MODE], indirect=True), +] + + +@pytest.mark.startup +def test_clp_json_startup(fixt_package_instance: PackageInstance) -> None: + """ + Validate that the `clp-json` package starts up successfully. + + :param fixt_package_instance: + """ + validate_package_instance(fixt_package_instance) + + log_msg = "test_clp_json_startup was successful." + logger.info(log_msg) + + +@pytest.mark.compression +def test_clp_json_compression_multifile(fixt_package_instance: PackageInstance) -> None: + """ + Validate that the `clp-json` package successfully compresses the `json-multifile` dataset. + + :param fixt_package_instance: + """ + validate_package_instance(fixt_package_instance) + + # TODO: compress the json-multifile dataset and check the correctness of compression. + assert True + + log_msg = "test_clp_json_compression_multifile was successful." + logger.info(log_msg) diff --git a/integration-tests/tests/package_tests/clp_text/__init__.py b/integration-tests/tests/package_tests/clp_text/__init__.py new file mode 100644 index 0000000000..af5538ec4c --- /dev/null +++ b/integration-tests/tests/package_tests/clp_text/__init__.py @@ -0,0 +1 @@ +"""Top-level package for clp-text package integration tests.""" diff --git a/integration-tests/tests/package_tests/clp_text/test_clp_text.py b/integration-tests/tests/package_tests/clp_text/test_clp_text.py new file mode 100644 index 0000000000..8f29e72fe4 --- /dev/null +++ b/integration-tests/tests/package_tests/clp_text/test_clp_text.py @@ -0,0 +1,53 @@ +"""Tests for the clp-text package.""" + +import logging + +import pytest +from clp_py_utils.clp_config import ( + ClpConfig, + Package, + QueryEngine, + StorageEngine, +) + +from tests.utils.asserting_utils import ( + validate_package_instance, +) +from tests.utils.clp_mode_utils import CLP_BASE_COMPONENTS +from tests.utils.config import PackageInstance, PackageModeConfig + +logger = logging.getLogger(__name__) + + +# Mode description for this module. +CLP_TEXT_MODE = PackageModeConfig( + mode_name="clp-text", + clp_config=ClpConfig( + package=Package( + storage_engine=StorageEngine.CLP, + query_engine=QueryEngine.CLP, + ), + api_server=None, + log_ingestor=None, + ), + component_list=[ + *CLP_BASE_COMPONENTS, + ], +) + + +# Pytest markers for this module. +pytestmark = [ + pytest.mark.package, + pytest.mark.clp_text, + pytest.mark.parametrize("fixt_package_test_config", [CLP_TEXT_MODE], indirect=True), +] + + +@pytest.mark.startup +def test_clp_text_startup(fixt_package_instance: PackageInstance) -> None: + """Tests package startup.""" + validate_package_instance(fixt_package_instance) + + log_msg = f"{CLP_TEXT_MODE.mode_name} is running successfully." + logger.info(log_msg) diff --git a/integration-tests/tests/test_package_start.py b/integration-tests/tests/test_package_start.py deleted file mode 100644 index 0603cf2cb0..0000000000 --- a/integration-tests/tests/test_package_start.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Integration tests verifying that the CLP package can be started and stopped.""" - -import pytest - -from tests.utils.asserting_utils import ( - validate_package_running, - validate_running_mode_correct, -) -from tests.utils.clp_mode_utils import CLP_MODE_CONFIGS -from tests.utils.config import PackageInstance - -TEST_MODES = CLP_MODE_CONFIGS.keys() - - -@pytest.mark.package -@pytest.mark.parametrize("fixt_package_config", TEST_MODES, indirect=True) -def test_clp_package(fixt_package_instance: PackageInstance) -> None: - """ - Validate that the CLP package starts up successfully for the selected mode(s) of operation. - - :param fixt_package_instance: - """ - # Ensure that all package components are running. - validate_package_running(fixt_package_instance) - - # Ensure that the package is running in the correct mode. - validate_running_mode_correct(fixt_package_instance) diff --git a/integration-tests/tests/utils/asserting_utils.py b/integration-tests/tests/utils/asserting_utils.py index 651f67ea2e..402739417e 100644 --- a/integration-tests/tests/utils/asserting_utils.py +++ b/integration-tests/tests/utils/asserting_utils.py @@ -37,7 +37,26 @@ def run_and_assert(cmd: list[str], **kwargs: Any) -> subprocess.CompletedProcess return proc -def validate_package_running(package_instance: PackageInstance) -> None: +def validate_package_instance(package_instance: PackageInstance) -> None: + """ + Validate that the given package instance is running by performing two checks: validate that the + instance has exactly the set of running components that it should have, and validate that the + instance is running in the correct mode. + + :param package_instance: + """ + if not package_instance.instance_validated: + # Ensure that all package components are running. + _validate_package_running(package_instance) + + # Ensure that the package is running in the correct mode. + _validate_running_mode_correct(package_instance) + + # Switch validation indicator to True. + object.__setattr__(package_instance, "instance_validated", True) + + +def _validate_package_running(package_instance: PackageInstance) -> None: """ Validate that the given package instance is running by checking that the set of services running in the Compose project exactly matches the list of required components. @@ -51,7 +70,7 @@ def validate_package_running(package_instance: PackageInstance) -> None: running_services = set(list_running_services_in_compose_project(project_name)) # Compare with list of required components. - required_components = set(package_instance.package_config.component_list) + required_components = set(package_instance.package_test_config.mode_config.component_list) if required_components == running_services: return @@ -68,7 +87,7 @@ def validate_package_running(package_instance: PackageInstance) -> None: pytest.fail(fail_msg) -def validate_running_mode_correct(package_instance: PackageInstance) -> None: +def _validate_running_mode_correct(package_instance: PackageInstance) -> None: """ Validate that the mode described in the shared config of the instance matches the intended mode defined by the instance configuration. Calls pytest.fail if the shared config fails validation @@ -85,7 +104,7 @@ def validate_running_mode_correct(package_instance: PackageInstance) -> None: except ValidationError as err: pytest.fail(f"Shared config failed validation: {err}") - intended_config = package_instance.package_config.clp_config + intended_config = package_instance.package_test_config.mode_config.clp_config if not compare_mode_signatures(intended_config, running_config): pytest.fail("Mode mismatch: running configuration does not match intended configuration.") diff --git a/integration-tests/tests/utils/clp_mode_utils.py b/integration-tests/tests/utils/clp_mode_utils.py index 07370bc233..4eb85c19a1 100644 --- a/integration-tests/tests/utils/clp_mode_utils.py +++ b/integration-tests/tests/utils/clp_mode_utils.py @@ -1,6 +1,5 @@ """Provides utilities related to the user-level configurations of CLP's operating modes.""" -from collections.abc import Callable from typing import Any from clp_py_utils.clp_config import ( @@ -10,36 +9,16 @@ COMPRESSION_WORKER_COMPONENT_NAME, DB_COMPONENT_NAME, GARBAGE_COLLECTOR_COMPONENT_NAME, - Package, QUERY_SCHEDULER_COMPONENT_NAME, QUERY_WORKER_COMPONENT_NAME, - QueryEngine, QUEUE_COMPONENT_NAME, REDIS_COMPONENT_NAME, REDUCER_COMPONENT_NAME, RESULTS_CACHE_COMPONENT_NAME, - StorageEngine, WEBUI_COMPONENT_NAME, ) from pydantic import BaseModel -CLP_MODE_CONFIGS: dict[str, Callable[[], ClpConfig]] = { - "clp-text": lambda: ClpConfig( - package=Package( - storage_engine=StorageEngine.CLP, - query_engine=QueryEngine.CLP, - ), - api_server=None, - log_ingestor=None, - ), - "clp-json": lambda: ClpConfig( - package=Package( - storage_engine=StorageEngine.CLP_S, - query_engine=QueryEngine.CLP_S, - ), - ), -} - # TODO: This will eventually be replaced by a formalized mapping between component and service. def _to_docker_compose_service_name(name: str) -> str: @@ -52,7 +31,7 @@ def _to_docker_compose_service_name(name: str) -> str: return name.replace("_", "-") -# These component lists should be maintained alongside the CLP_MODE_CONFIGS list. +# These component lists should agree with the component lists of each package operating mode. # TODO: Modify these component lists when the Presto Docker Compose project is integrated with the # CLP Docker compose project. CLP_BASE_COMPONENTS = [ @@ -84,38 +63,6 @@ def compare_mode_signatures(intended_config: ClpConfig, running_config: ClpConfi return _match_objects_by_explicit_fields(intended_config, running_config) -def get_clp_config_from_mode(mode_name: str) -> ClpConfig: - """ - Return a ClpConfig object for the given mode name. - - :param mode_name: - :return: ClpConfig object corresponding to the mode. - :raise ValueError: If the mode is not supported. - """ - if mode_name not in CLP_MODE_CONFIGS: - err_msg = f"Unsupported mode: {mode_name}" - raise ValueError(err_msg) - return CLP_MODE_CONFIGS[mode_name]() - - -def get_required_component_list(config: ClpConfig) -> list[str]: - """ - Constructs the list of components required for the CLP package described in `config` to run - properly. - - This function should be maintained alongside the CLP_MODE_CONFIGS list. - - :param config: - :return: List of components required by the package. - """ - component_list: list[str] = list(CLP_BASE_COMPONENTS) - - if config.api_server is not None: - component_list.append(CLP_API_SERVER_COMPONENT) - - return component_list - - def _match_objects_by_explicit_fields(intended_obj: Any, running_obj: Any) -> bool: """ Compares `intended_obj` and `running_obj` using Pydantic's `model_fields_set` to recursively diff --git a/integration-tests/tests/utils/config.py b/integration-tests/tests/utils/config.py index ee9fc94a5a..521109ebd3 100644 --- a/integration-tests/tests/utils/config.py +++ b/integration-tests/tests/utils/config.py @@ -120,39 +120,47 @@ def stop_script_path(self) -> Path: return self.clp_package_dir / "sbin" / "stop-clp.sh" -@dataclass(frozen=True) -class PackageConfig: - """Metadata for a specific configuration of the CLP package.""" - - #: Path configuration for this package. - path_config: PackagePathConfig +@dataclass() +class PackageModeConfig: + """Mode configuration for the CLP package.""" #: Name of the package operation mode. mode_name: str + #: The Pydantic representation of the package operation mode. + clp_config: ClpConfig + #: The list of CLP components that this package needs. component_list: list[str] - #: The Pydantic representation of a CLP package configuration. - clp_config: ClpConfig - #: The base port from which all ports for the components are derived. +@dataclass() +class PackageTestConfig: + """Metadata for a specific test of the CLP package.""" + + #: Path configuration for this package test. + path_config: PackagePathConfig + + #: Mode configuration for this package test. + mode_config: PackageModeConfig + + #: The base port from which all port assignments are derived. base_port: int def __post_init__(self) -> None: - """Write the temporary config file for this package.""" + """Write the temporary config file for this package test.""" self._write_temp_config_file() @property def temp_config_file_path(self) -> Path: """:return: The absolute path to the temporary configuration file for the package.""" - return self.path_config.temp_config_dir / f"clp-config-{self.mode_name}.yaml" + return self.path_config.temp_config_dir / f"clp-config-{self.mode_config.mode_name}.yaml" def _write_temp_config_file(self) -> None: - """Writes the temporary config file for this package.""" + """Writes the temporary config file for this package test.""" temp_config_file_path = self.temp_config_file_path - payload = self.clp_config.dump_to_primitive_dict() # type: ignore[no-untyped-call] + payload = self.mode_config.clp_config.dump_to_primitive_dict() # type: ignore[no-untyped-call] tmp_path = temp_config_file_path.with_suffix(temp_config_file_path.suffix + ".tmp") with tmp_path.open("w", encoding="utf-8") as f: @@ -160,12 +168,12 @@ def _write_temp_config_file(self) -> None: tmp_path.replace(temp_config_file_path) -@dataclass(frozen=True) +@dataclass() class PackageInstance: """Metadata for a running instance of the CLP package.""" #: The configuration for this package instance. - package_config: PackageConfig + package_test_config: PackageTestConfig #: The instance ID of the running package. clp_instance_id: str = field(init=False, repr=True) @@ -173,13 +181,16 @@ class PackageInstance: #: The path to the .clp-config.yaml file constructed by the package during spin up. shared_config_file_path: Path = field(init=False, repr=True) + #: Switch indicating whether or not this instance has been validated yet. + instance_validated: bool = False + def __post_init__(self) -> None: """Validates init values and initializes attributes.""" # Validate that the temp config file exists. - validate_file_exists(self.package_config.temp_config_file_path) + validate_file_exists(self.package_test_config.temp_config_file_path) # Set clp_instance_id from instance-id file. - path_config = self.package_config.path_config + path_config = self.package_test_config.path_config clp_instance_id_file_path = path_config.clp_log_dir / "instance-id" validate_file_exists(clp_instance_id_file_path) clp_instance_id = self._get_clp_instance_id(clp_instance_id_file_path) diff --git a/integration-tests/tests/utils/package_utils.py b/integration-tests/tests/utils/package_utils.py index 7d714f707a..31254b8791 100644 --- a/integration-tests/tests/utils/package_utils.py +++ b/integration-tests/tests/utils/package_utils.py @@ -1,21 +1,21 @@ """Provides utility functions related to the CLP package used across `integration-tests`.""" from tests.utils.asserting_utils import run_and_assert -from tests.utils.config import PackageConfig +from tests.utils.config import PackageTestConfig DEFAULT_CMD_TIMEOUT_SECONDS = 120.0 -def start_clp_package(package_config: PackageConfig) -> None: +def start_clp_package(package_test_config: PackageTestConfig) -> None: """ Starts an instance of the CLP package. - :param package_config: + :param package_test_config: :raise: Propagates `run_and_assert`'s errors. """ - path_config = package_config.path_config + path_config = package_test_config.path_config start_script_path = path_config.start_script_path - temp_config_file_path = package_config.temp_config_file_path + temp_config_file_path = package_test_config.temp_config_file_path # fmt: off start_cmd = [ @@ -26,16 +26,16 @@ def start_clp_package(package_config: PackageConfig) -> None: run_and_assert(start_cmd, timeout=DEFAULT_CMD_TIMEOUT_SECONDS) -def stop_clp_package(package_config: PackageConfig) -> None: +def stop_clp_package(package_test_config: PackageTestConfig) -> None: """ Stops the running instance of the CLP package. - :param package_config: + :param package_test_config: :raise: Propagates `run_and_assert`'s errors. """ - path_config = package_config.path_config + path_config = package_test_config.path_config stop_script_path = path_config.stop_script_path - temp_config_file_path = package_config.temp_config_file_path + temp_config_file_path = package_test_config.temp_config_file_path # fmt: off stop_cmd = [ From 890b1e2967add250044fefc2a074d3d4bfdb8f50 Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 6 Jan 2026 22:12:24 +0000 Subject: [PATCH 2/8] Remove sample dataset from this PR. --- .../datasets/json-multifile/README.md | 19 ------------------- .../logs/sts-135-2011-07-08.jsonl | 8 -------- .../logs/sts-135-2011-07-09.jsonl | 8 -------- .../logs/sts-135-2011-07-11.jsonl | 8 -------- .../logs/sts-135-2011-07-19.jsonl | 8 -------- .../logs/sts-135-2011-07-21.jsonl | 8 -------- 6 files changed, 59 deletions(-) delete mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md delete mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl delete mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl delete mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl delete mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl delete mode 100644 integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md deleted file mode 100644 index 3ecb69da25..0000000000 --- a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# Description of logs - -**Type** -JSONL - -**Number of files** -5 - -**Number of events per file** -8 - -**Beginning timestamp (milliseconds)** -1310138944000 - -**End timestamp (milliseconds)** -1311208074120 - -**Authoritative timestamp*** -timestamp diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl deleted file mode 100644 index 1ba45d0ec1..0000000000 --- a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-08.jsonl +++ /dev/null @@ -1,8 +0,0 @@ -{"timestamp":1310138944000,"mission":"STS-135","mission_day_index":0,"event":"SRB_IGNITION_CONFIRMED","subsystem":"PROP","level":"INFO","detail":"Solid rocket boosters report stable ignition and rising thrust","line_index":0} -{"timestamp":1310139148373,"mission":"STS-135","mission_day_index":0,"event":"CLEAR_OF_TOWER","subsystem":"GUIDANCE","level":"INFO","detail":"Vehicle cleared tower, roll program initiated, tracking nominal trajectory","line_index":1} -{"timestamp":1310139352746,"mission":"STS-135","mission_day_index":0,"event":"ROLL_PROGRAM_COMPLETE","subsystem":"GUIDANCE","level":"INFO","detail":"Roll program complete, heads down attitude achieved for ascent","line_index":2} -{"timestamp":1310139557119,"mission":"STS-135","mission_day_index":0,"event":"MAX_Q_THROTTLE","subsystem":"PROP","level":"INFO","detail":"Main engines throttled to manage maximum dynamic pressure on stack","line_index":3} -{"timestamp":1310139761493,"mission":"STS-135","mission_day_index":0,"event":"SRB_SEPARATION","subsystem":"PROP","level":"INFO","detail":"Solid rocket boosters separation confirmed, separation motors firing nominally","line_index":4} -{"timestamp":1310139965866,"mission":"STS-135","mission_day_index":0,"event":"PRESS_TO_MECO","subsystem":"GUIDANCE","level":"INFO","detail":"Performance marks indicate press to main engine cutoff achieved","line_index":5} -{"timestamp":1310140170239,"mission":"STS-135","mission_day_index":0,"event":"MAIN_ENGINE_CUTOFF","subsystem":"PROP","level":"INFO","detail":"All three SSME engines shutdown, engine parameters within expected bands","line_index":6} -{"timestamp":1310140374613,"mission":"STS-135","mission_day_index":0,"event":"EXTERNAL_TANK_SEPARATION","subsystem":"STRUCTURES","level":"INFO","detail":"External tank separation command executed, umbilical disconnect nominal","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl deleted file mode 100644 index 89650afd46..0000000000 --- a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-09.jsonl +++ /dev/null @@ -1,8 +0,0 @@ -{"timestamp":1310169600000,"mission":"STS-135","mission_day_index":1,"event":"RNDZ_BURN","subsystem":"GUIDANCE","level":"INFO","detail":"Rendezvous correction burn complete, relative motion profile matches ISS plan","line_index":0} -{"timestamp":1310170175999,"mission":"STS-135","mission_day_index":1,"event":"RPM_MANEUVER","subsystem":"GUIDANCE","level":"INFO","detail":"R bar pitch maneuver complete for station imaging and TPS assessment","line_index":1} -{"timestamp":1310170751999,"mission":"STS-135","mission_day_index":1,"event":"FINAL_APPROACH","subsystem":"GUIDANCE","level":"INFO","detail":"Final approach corridor maintained, closing rate within docking constraints","line_index":2} -{"timestamp":1310171327999,"mission":"STS-135","mission_day_index":1,"event":"SOFT_DOCK","subsystem":"DOCKING","level":"INFO","detail":"Soft capture confirmed at forward port, relative motion damped","line_index":3} -{"timestamp":1310171903999,"mission":"STS-135","mission_day_index":1,"event":"HARD_DOCK","subsystem":"DOCKING","level":"INFO","detail":"Structural latches engaged, ISS and shuttle in hard dock configuration","line_index":4} -{"timestamp":1310172479999,"mission":"STS-135","mission_day_index":1,"event":"HATCH_OPEN","subsystem":"STRUCTURES","level":"INFO","detail":"Hatch open for ingress, pressure equalization verified within safe band","line_index":5} -{"timestamp":1310173055999,"mission":"STS-135","mission_day_index":1,"event":"MPLM_BERTHING","subsystem":"ROBOTICS","level":"INFO","detail":"Multipurpose logistics module berthed to Node, structural attach points verified","line_index":6} -{"timestamp":1310173631999,"mission":"STS-135","mission_day_index":1,"event":"CARGO_TRANSFER","subsystem":"PAYLOAD","level":"INFO","detail":"Cargo transfer underway according to integrated ISS and shuttle transfer list","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl deleted file mode 100644 index cdbabf0945..0000000000 --- a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-11.jsonl +++ /dev/null @@ -1,8 +0,0 @@ -{"timestamp":1310342400000,"mission":"STS-135","mission_day_index":3,"event":"JOINT_OPERATIONS_PLANNING","subsystem":"TIMELINE","level":"INFO","detail":"Daily planning conference complete, joint tasks synchronized","line_index":0} -{"timestamp":1310342975999,"mission":"STS-135","mission_day_index":3,"event":"EVA_PREP","subsystem":"EVA","level":"INFO","detail":"Extravehicular mobility units serviced, prebreathe protocols initiated","line_index":1} -{"timestamp":1310343551999,"mission":"STS-135","mission_day_index":3,"event":"EVA_TASK_STATUS","subsystem":"EVA","level":"INFO","detail":"Truss and payload bay tasks progressing, consumables within expected usage","line_index":2} -{"timestamp":1310344127999,"mission":"STS-135","mission_day_index":3,"event":"MPLM_UNBERTH","subsystem":"ROBOTICS","level":"INFO","detail":"Logistics module unberthed and reinstalled in payload bay","line_index":3} -{"timestamp":1310344703999,"mission":"STS-135","mission_day_index":3,"event":"ISS_SYSTEMS_HANDOFF","subsystem":"COMMS","level":"INFO","detail":"Command and telemetry handoff between shuttle and station completed","line_index":4} -{"timestamp":1310345279999,"mission":"STS-135","mission_day_index":3,"event":"MIDDECK_PAYLOAD_CHECK","subsystem":"PAYLOAD","level":"INFO","detail":"Middeck experiment racks powered and data recording verified","line_index":5} -{"timestamp":1310345855999,"mission":"STS-135","mission_day_index":3,"event":"ENVIRONMENTAL_MONITORING","subsystem":"ECLSS","level":"INFO","detail":"Atmospheric sampling shows stable CO2 and trace contaminant levels","line_index":6} -{"timestamp":1310346431999,"mission":"STS-135","mission_day_index":3,"event":"JOINT_CREW_MEETING","subsystem":"TIMELINE","level":"INFO","detail":"Joint crew status review completed, no blocking issues reported","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl deleted file mode 100644 index c60ff4341a..0000000000 --- a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-19.jsonl +++ /dev/null @@ -1,8 +0,0 @@ -{"timestamp":1311033600000,"mission":"STS-135","mission_day_index":11,"event":"UNDOCK_COMMAND","subsystem":"DOCKING","level":"INFO","detail":"Undock command executed, structural latches release verified","line_index":0} -{"timestamp":1311034175999,"mission":"STS-135","mission_day_index":11,"event":"SEPARATION_BURNS","subsystem":"GUIDANCE","level":"INFO","detail":"Separation maneuvers complete, increasing range rate from station","line_index":1} -{"timestamp":1311034751999,"mission":"STS-135","mission_day_index":11,"event":"TPS_INSPECTION","subsystem":"THERMAL","level":"INFO","detail":"Thermal protection system sensor data and imagery show no critical damage","line_index":2} -{"timestamp":1311035327999,"mission":"STS-135","mission_day_index":11,"event":"DEORBIT_BURN","subsystem":"PROP","level":"INFO","detail":"Deorbit burn complete, entry interface conditions within design envelope","line_index":3} -{"timestamp":1311035903999,"mission":"STS-135","mission_day_index":11,"event":"ENTRY_INTERFACE","subsystem":"GUIDANCE","level":"INFO","detail":"Vehicle at entry interface, guidance following nominal drag corridor","line_index":4} -{"timestamp":1311036479999,"mission":"STS-135","mission_day_index":11,"event":"COMM_BLACKOUT","subsystem":"COMMS","level":"INFO","detail":"Expected communications blackout region entered, tracking via ground radar only","line_index":5} -{"timestamp":1311037055999,"mission":"STS-135","mission_day_index":11,"event":"SUBSONIC_TRANSITION","subsystem":"GUIDANCE","level":"INFO","detail":"Shuttle transitions to subsonic flight, control surfaces active","line_index":6} -{"timestamp":1311037631999,"mission":"STS-135","mission_day_index":11,"event":"WHEELS_STOP","subsystem":"TIMELINE","level":"INFO","detail":"Vehicle stopped on runway, rollout distance within predicted range","line_index":7} diff --git a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl b/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl deleted file mode 100644 index f2b7aa9ec8..0000000000 --- a/integration-tests/tests/package_tests/clp_json/datasets/json-multifile/logs/sts-135-2011-07-21.jsonl +++ /dev/null @@ -1,8 +0,0 @@ -{"timestamp":1311206400000,"mission":"STS-135","mission_day_index":13,"event":"PAYLOAD_UNLOAD","subsystem":"PAYLOAD","level":"INFO","detail":"Post flight payload processing under way, canisters removed from bay","line_index":0} -{"timestamp":1311206639160,"mission":"STS-135","mission_day_index":13,"event":"VEHICLE_SAFE","subsystem":"GROUND","level":"INFO","detail":"Hazardous systems safed, access teams cleared for orbiter entry","line_index":1} -{"timestamp":1311206878320,"mission":"STS-135","mission_day_index":13,"event":"DATA_ARCHIVE","subsystem":"GROUND","level":"INFO","detail":"Flight data downlinked and archived for post mission analysis","line_index":2} -{"timestamp":1311207117480,"mission":"STS-135","mission_day_index":13,"event":"CREW_DEBRIEF","subsystem":"TIMELINE","level":"INFO","detail":"Crew debrief with mission control completed without anomalies","line_index":3} -{"timestamp":1311207356640,"mission":"STS-135","mission_day_index":13,"event":"VEHICLE_TOW","subsystem":"GROUND","level":"INFO","detail":"Atlantis towed from runway to Orbiter Processing Facility","line_index":4} -{"timestamp":1311207595800,"mission":"STS-135","mission_day_index":13,"event":"RETIREMENT_CONFIG","subsystem":"GROUND","level":"INFO","detail":"Systems configured for extended safe power down and display conversion","line_index":5} -{"timestamp":1311207834960,"mission":"STS-135","mission_day_index":13,"event":"PUBLIC_EVENT","subsystem":"OUTREACH","level":"INFO","detail":"Crew participates in public event describing program closeout activities","line_index":6} -{"timestamp":1311208074120,"mission":"STS-135","mission_day_index":13,"event":"HARDWARE_REUSE_ASSESSMENT","subsystem":"ENGINEERING","level":"INFO","detail":"Component assessments identify candidates for museum display","line_index":7} From 7033ab7f347ea52971ac38c2f49a6f6b7b8b7784 Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 6 Jan 2026 22:32:15 +0000 Subject: [PATCH 3/8] Rabbit. --- integration-tests/.pytest.ini | 6 ++--- .../package_tests/clp_json/test_clp_json.py | 27 ++++++++++++++++--- .../package_tests/clp_text/test_clp_text.py | 2 +- .../tests/utils/asserting_utils.py | 2 +- integration-tests/tests/utils/config.py | 6 ++--- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/integration-tests/.pytest.ini b/integration-tests/.pytest.ini index dc35b66a2f..6124409099 100644 --- a/integration-tests/.pytest.ini +++ b/integration-tests/.pytest.ini @@ -1,9 +1,9 @@ [pytest] addopts = - ; --capture=no + --capture=no --code-highlight=yes --color=yes - ; -rA + -rA --strict-config --strict-markers --verbose @@ -23,5 +23,5 @@ markers = compression: mark tests that test compression core: mark tests that test the CLP core binaries package: mark tests that use the CLP package - search: search tests + search: mark tests that test search startup: mark tests that test startup diff --git a/integration-tests/tests/package_tests/clp_json/test_clp_json.py b/integration-tests/tests/package_tests/clp_json/test_clp_json.py index 5f7d6a3a33..947d10b372 100644 --- a/integration-tests/tests/package_tests/clp_json/test_clp_json.py +++ b/integration-tests/tests/package_tests/clp_json/test_clp_json.py @@ -54,16 +54,35 @@ def test_clp_json_startup(fixt_package_instance: PackageInstance) -> None: @pytest.mark.compression -def test_clp_json_compression_multifile(fixt_package_instance: PackageInstance) -> None: +def test_clp_json_compression(fixt_package_instance: PackageInstance) -> None: """ - Validate that the `clp-json` package successfully compresses the `json-multifile` dataset. + Validate that the `clp-json` package successfully compresses some dataset. :param fixt_package_instance: """ validate_package_instance(fixt_package_instance) - # TODO: compress the json-multifile dataset and check the correctness of compression. + # TODO: compress some dataset and check the correctness of compression. assert True - log_msg = "test_clp_json_compression_multifile was successful." + log_msg = "test_clp_json_compression was successful." + logger.info(log_msg) + + +@pytest.mark.search +def test_clp_json_search(fixt_package_instance: PackageInstance) -> None: + """ + Validate that the `clp-json` package successfully searches some dataset. + + :param fixt_package_instance: + """ + validate_package_instance(fixt_package_instance) + + # TODO: compress some dataset and check the correctness of compression. + + # TODO: search through that dataset and check the correctness of the search results. + + assert True + + log_msg = "test_clp_json_search was successful." logger.info(log_msg) diff --git a/integration-tests/tests/package_tests/clp_text/test_clp_text.py b/integration-tests/tests/package_tests/clp_text/test_clp_text.py index 8f29e72fe4..9e1a5d02b5 100644 --- a/integration-tests/tests/package_tests/clp_text/test_clp_text.py +++ b/integration-tests/tests/package_tests/clp_text/test_clp_text.py @@ -49,5 +49,5 @@ def test_clp_text_startup(fixt_package_instance: PackageInstance) -> None: """Tests package startup.""" validate_package_instance(fixt_package_instance) - log_msg = f"{CLP_TEXT_MODE.mode_name} is running successfully." + log_msg = "test_clp_text_startup is running successfully." logger.info(log_msg) diff --git a/integration-tests/tests/utils/asserting_utils.py b/integration-tests/tests/utils/asserting_utils.py index 402739417e..71bee6483f 100644 --- a/integration-tests/tests/utils/asserting_utils.py +++ b/integration-tests/tests/utils/asserting_utils.py @@ -53,7 +53,7 @@ def validate_package_instance(package_instance: PackageInstance) -> None: _validate_running_mode_correct(package_instance) # Switch validation indicator to True. - object.__setattr__(package_instance, "instance_validated", True) + package_instance.instance_validated = True def _validate_package_running(package_instance: PackageInstance) -> None: diff --git a/integration-tests/tests/utils/config.py b/integration-tests/tests/utils/config.py index 521109ebd3..c1274d8e43 100644 --- a/integration-tests/tests/utils/config.py +++ b/integration-tests/tests/utils/config.py @@ -120,7 +120,7 @@ def stop_script_path(self) -> Path: return self.clp_package_dir / "sbin" / "stop-clp.sh" -@dataclass() +@dataclass class PackageModeConfig: """Mode configuration for the CLP package.""" @@ -134,7 +134,7 @@ class PackageModeConfig: component_list: list[str] -@dataclass() +@dataclass class PackageTestConfig: """Metadata for a specific test of the CLP package.""" @@ -168,7 +168,7 @@ def _write_temp_config_file(self) -> None: tmp_path.replace(temp_config_file_path) -@dataclass() +@dataclass class PackageInstance: """Metadata for a running instance of the CLP package.""" From 1ca90952525fb0475f188e6f7339d5952eafe90c Mon Sep 17 00:00:00 2001 From: Quinn Date: Mon, 26 Jan 2026 16:12:20 +0000 Subject: [PATCH 4/8] Address Bill comments. --- integration-tests/tests/fixtures/package_instance.py | 3 +++ integration-tests/tests/fixtures/package_test_config.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/integration-tests/tests/fixtures/package_instance.py b/integration-tests/tests/fixtures/package_instance.py index a3aaf9cf4c..c4425cdca5 100644 --- a/integration-tests/tests/fixtures/package_instance.py +++ b/integration-tests/tests/fixtures/package_instance.py @@ -19,6 +19,9 @@ def fixt_package_instance(fixt_package_test_config: PackageTestConfig) -> Iterat """ Starts a CLP package instance for the given configuration and stops it during teardown. + This fixture relies on `fixt_package_test_config`, and as such, the scope of this fixture should + never exceed that of `fixt_package_test_config`. + :param fixt_package_test_config: :return: Iterator that yields the running package instance. """ diff --git a/integration-tests/tests/fixtures/package_test_config.py b/integration-tests/tests/fixtures/package_test_config.py index 4f33c0a7db..ad42f88f51 100644 --- a/integration-tests/tests/fixtures/package_test_config.py +++ b/integration-tests/tests/fixtures/package_test_config.py @@ -16,7 +16,12 @@ def fixt_package_test_config( """ Creates and maintains a PackageTestConfig object for a specific CLP mode. - :param request: + This fixture is initialized on a per-module basis using `request.param`. Test code that uses + this fixture should set this parameter with `pytest.mark.parametrize()`. + + Any fixture that depends on this one must have a scope less than or equal to `module`. + + :param request: Provides access to `PackageModeConfig` selection. :return: An iterator that yields the PackageTestConfig object for the specified mode. :raise ValueError: if the CLP base port's value is invalid. """ From b466ae7c3af4a34709bd7ac51978062af6d8b0c1 Mon Sep 17 00:00:00 2001 From: Quinn Taylor Mitchell Date: Mon, 26 Jan 2026 12:11:44 -0500 Subject: [PATCH 5/8] Update integration-tests/tests/utils/config.py Co-authored-by: Bingran Hu --- integration-tests/tests/utils/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-tests/tests/utils/config.py b/integration-tests/tests/utils/config.py index c1274d8e43..4a66bd5b4c 100644 --- a/integration-tests/tests/utils/config.py +++ b/integration-tests/tests/utils/config.py @@ -181,7 +181,8 @@ class PackageInstance: #: The path to the .clp-config.yaml file constructed by the package during spin up. shared_config_file_path: Path = field(init=False, repr=True) - #: Switch indicating whether or not this instance has been validated yet. + #: Flag indicating whether this package instance has completed all validation checks. When set, + #: subsequent tests reusing the same instance can skip redundant validation. instance_validated: bool = False def __post_init__(self) -> None: From 255df5ec19760045aeefdc8feb48ca79e0eaadbc Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 27 Jan 2026 16:04:26 +0000 Subject: [PATCH 6/8] Address Junhao comments. --- .../tests/fixtures/package_test_config.py | 10 +++------- .../tests/package_tests/clp_json/__init__.py | 2 +- .../tests/package_tests/clp_text/__init__.py | 2 +- .../tests/package_tests/clp_text/test_clp_text.py | 2 +- integration-tests/tests/utils/asserting_utils.py | 12 ++++-------- integration-tests/tests/utils/clp_mode_utils.py | 3 ++- integration-tests/tests/utils/config.py | 4 ---- 7 files changed, 12 insertions(+), 23 deletions(-) diff --git a/integration-tests/tests/fixtures/package_test_config.py b/integration-tests/tests/fixtures/package_test_config.py index ad42f88f51..e10ae7f3b9 100644 --- a/integration-tests/tests/fixtures/package_test_config.py +++ b/integration-tests/tests/fixtures/package_test_config.py @@ -14,14 +14,10 @@ def fixt_package_test_config( fixt_package_path_config: PackagePathConfig, ) -> Iterator[PackageTestConfig]: """ - Creates and maintains a PackageTestConfig object for a specific CLP mode. + Creates and maintains a module-level PackageTestConfig object for a specific CLP mode. For + efficiency, group all tests for a given mode in the same module. - This fixture is initialized on a per-module basis using `request.param`. Test code that uses - this fixture should set this parameter with `pytest.mark.parametrize()`. - - Any fixture that depends on this one must have a scope less than or equal to `module`. - - :param request: Provides access to `PackageModeConfig` selection. + :param request: Provides `PackageModeConfig` via `request.param`. :return: An iterator that yields the PackageTestConfig object for the specified mode. :raise ValueError: if the CLP base port's value is invalid. """ diff --git a/integration-tests/tests/package_tests/clp_json/__init__.py b/integration-tests/tests/package_tests/clp_json/__init__.py index 3a36260bc8..e84f07103f 100644 --- a/integration-tests/tests/package_tests/clp_json/__init__.py +++ b/integration-tests/tests/package_tests/clp_json/__init__.py @@ -1 +1 @@ -"""Top-level package for clp-json package integration tests.""" +"""Integration tests for the clp-json package.""" diff --git a/integration-tests/tests/package_tests/clp_text/__init__.py b/integration-tests/tests/package_tests/clp_text/__init__.py index af5538ec4c..85f1b137d5 100644 --- a/integration-tests/tests/package_tests/clp_text/__init__.py +++ b/integration-tests/tests/package_tests/clp_text/__init__.py @@ -1 +1 @@ -"""Top-level package for clp-text package integration tests.""" +"""Integration tests for the clp-text package.""" diff --git a/integration-tests/tests/package_tests/clp_text/test_clp_text.py b/integration-tests/tests/package_tests/clp_text/test_clp_text.py index 9e1a5d02b5..5119b87451 100644 --- a/integration-tests/tests/package_tests/clp_text/test_clp_text.py +++ b/integration-tests/tests/package_tests/clp_text/test_clp_text.py @@ -49,5 +49,5 @@ def test_clp_text_startup(fixt_package_instance: PackageInstance) -> None: """Tests package startup.""" validate_package_instance(fixt_package_instance) - log_msg = "test_clp_text_startup is running successfully." + log_msg = "test_clp_text_startup was successful." logger.info(log_msg) diff --git a/integration-tests/tests/utils/asserting_utils.py b/integration-tests/tests/utils/asserting_utils.py index 71bee6483f..0a9b78e424 100644 --- a/integration-tests/tests/utils/asserting_utils.py +++ b/integration-tests/tests/utils/asserting_utils.py @@ -45,15 +45,11 @@ def validate_package_instance(package_instance: PackageInstance) -> None: :param package_instance: """ - if not package_instance.instance_validated: - # Ensure that all package components are running. - _validate_package_running(package_instance) + # Ensure that all package components are running. + _validate_package_running(package_instance) - # Ensure that the package is running in the correct mode. - _validate_running_mode_correct(package_instance) - - # Switch validation indicator to True. - package_instance.instance_validated = True + # Ensure that the package is running in the correct mode. + _validate_running_mode_correct(package_instance) def _validate_package_running(package_instance: PackageInstance) -> None: diff --git a/integration-tests/tests/utils/clp_mode_utils.py b/integration-tests/tests/utils/clp_mode_utils.py index 4eb85c19a1..d99d662c00 100644 --- a/integration-tests/tests/utils/clp_mode_utils.py +++ b/integration-tests/tests/utils/clp_mode_utils.py @@ -31,7 +31,8 @@ def _to_docker_compose_service_name(name: str) -> str: return name.replace("_", "-") -# These component lists should agree with the component lists of each package operating mode. +# Names of components that may comprise a given package mode. Test modules use these lists to +# assemble mode-specific component lists (see tests/package_tests/*/test_*.py). # TODO: Modify these component lists when the Presto Docker Compose project is integrated with the # CLP Docker compose project. CLP_BASE_COMPONENTS = [ diff --git a/integration-tests/tests/utils/config.py b/integration-tests/tests/utils/config.py index 4a66bd5b4c..ea521cf4e0 100644 --- a/integration-tests/tests/utils/config.py +++ b/integration-tests/tests/utils/config.py @@ -181,10 +181,6 @@ class PackageInstance: #: The path to the .clp-config.yaml file constructed by the package during spin up. shared_config_file_path: Path = field(init=False, repr=True) - #: Flag indicating whether this package instance has completed all validation checks. When set, - #: subsequent tests reusing the same instance can skip redundant validation. - instance_validated: bool = False - def __post_init__(self) -> None: """Validates init values and initializes attributes.""" # Validate that the temp config file exists. From 40cfbace463d3665110598aa7ec13e29ccdb2ad9 Mon Sep 17 00:00:00 2001 From: Quinn Date: Wed, 28 Jan 2026 15:28:36 +0000 Subject: [PATCH 7/8] Change data classes to frozen. --- integration-tests/tests/utils/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-tests/tests/utils/config.py b/integration-tests/tests/utils/config.py index ea521cf4e0..b61c7f2d2e 100644 --- a/integration-tests/tests/utils/config.py +++ b/integration-tests/tests/utils/config.py @@ -120,7 +120,7 @@ def stop_script_path(self) -> Path: return self.clp_package_dir / "sbin" / "stop-clp.sh" -@dataclass +@dataclass(frozen=True) class PackageModeConfig: """Mode configuration for the CLP package.""" @@ -134,7 +134,7 @@ class PackageModeConfig: component_list: list[str] -@dataclass +@dataclass(frozen=True) class PackageTestConfig: """Metadata for a specific test of the CLP package.""" @@ -168,7 +168,7 @@ def _write_temp_config_file(self) -> None: tmp_path.replace(temp_config_file_path) -@dataclass +@dataclass(frozen=True) class PackageInstance: """Metadata for a running instance of the CLP package.""" From d8cf684407e4a502611b0c97690d84dc02467ee6 Mon Sep 17 00:00:00 2001 From: Quinn Date: Wed, 28 Jan 2026 15:44:32 +0000 Subject: [PATCH 8/8] Change component_list to tuple. --- .../tests/package_tests/clp_json/test_clp_json.py | 2 +- .../tests/package_tests/clp_text/test_clp_text.py | 4 +--- integration-tests/tests/utils/clp_mode_utils.py | 4 ++-- integration-tests/tests/utils/config.py | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/integration-tests/tests/package_tests/clp_json/test_clp_json.py b/integration-tests/tests/package_tests/clp_json/test_clp_json.py index 947d10b372..d3c48af72f 100644 --- a/integration-tests/tests/package_tests/clp_json/test_clp_json.py +++ b/integration-tests/tests/package_tests/clp_json/test_clp_json.py @@ -28,7 +28,7 @@ query_engine=QueryEngine.CLP_S, ), ), - component_list=[*CLP_BASE_COMPONENTS, CLP_API_SERVER_COMPONENT], + component_list=(*CLP_BASE_COMPONENTS, CLP_API_SERVER_COMPONENT), ) diff --git a/integration-tests/tests/package_tests/clp_text/test_clp_text.py b/integration-tests/tests/package_tests/clp_text/test_clp_text.py index 5119b87451..dbbc862f4c 100644 --- a/integration-tests/tests/package_tests/clp_text/test_clp_text.py +++ b/integration-tests/tests/package_tests/clp_text/test_clp_text.py @@ -30,9 +30,7 @@ api_server=None, log_ingestor=None, ), - component_list=[ - *CLP_BASE_COMPONENTS, - ], + component_list=(*CLP_BASE_COMPONENTS,), ) diff --git a/integration-tests/tests/utils/clp_mode_utils.py b/integration-tests/tests/utils/clp_mode_utils.py index d99d662c00..5a57d1458f 100644 --- a/integration-tests/tests/utils/clp_mode_utils.py +++ b/integration-tests/tests/utils/clp_mode_utils.py @@ -35,7 +35,7 @@ def _to_docker_compose_service_name(name: str) -> str: # assemble mode-specific component lists (see tests/package_tests/*/test_*.py). # TODO: Modify these component lists when the Presto Docker Compose project is integrated with the # CLP Docker compose project. -CLP_BASE_COMPONENTS = [ +CLP_BASE_COMPONENTS: tuple[str, ...] = ( _to_docker_compose_service_name(DB_COMPONENT_NAME), _to_docker_compose_service_name(QUEUE_COMPONENT_NAME), _to_docker_compose_service_name(REDIS_COMPONENT_NAME), @@ -47,7 +47,7 @@ def _to_docker_compose_service_name(name: str) -> str: _to_docker_compose_service_name(QUERY_SCHEDULER_COMPONENT_NAME), _to_docker_compose_service_name(QUERY_WORKER_COMPONENT_NAME), _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME), -] +) CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME) diff --git a/integration-tests/tests/utils/config.py b/integration-tests/tests/utils/config.py index b61c7f2d2e..76a8e2d43a 100644 --- a/integration-tests/tests/utils/config.py +++ b/integration-tests/tests/utils/config.py @@ -131,7 +131,7 @@ class PackageModeConfig: clp_config: ClpConfig #: The list of CLP components that this package needs. - component_list: list[str] + component_list: tuple[str, ...] @dataclass(frozen=True)