Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8e75e15
Test a generic clp package start up and spin down (default: clp-text).
quinntaylormitchell Oct 17, 2025
44ee20e
Merge branch 'main' into feature branch
quinntaylormitchell Oct 23, 2025
bbe0575
Expand to clp-text and clp-json; store JSON config pairs in temp conf…
quinntaylormitchell Oct 24, 2025
5cd47f8
Merge branch 'main' into feature branch
quinntaylormitchell Oct 30, 2025
c5375eb
Include and employ clp_py_utils.clp_config; refrain from using the us…
quinntaylormitchell Nov 1, 2025
2be837f
Lint.
quinntaylormitchell Nov 1, 2025
bf14b5e
Refactor; move all utility functions to utils files as appropriate.
quinntaylormitchell Nov 2, 2025
27b7f5b
Add comments.
quinntaylormitchell Nov 2, 2025
e041f0e
Streamline logger calls.
quinntaylormitchell Nov 2, 2025
75672fc
Deduplicate fixture code.
quinntaylormitchell Nov 2, 2025
0822a79
Merge branch 'main' into feature branch
quinntaylormitchell Nov 5, 2025
2df9515
Change method of clp_config import; temporary, will change again once…
quinntaylormitchell Nov 5, 2025
63f3ae4
Generalize code so that it's better equipped to handle future CLP_MOD…
quinntaylormitchell Nov 5, 2025
0011447
Merge branch 'main' into feature branch
quinntaylormitchell Nov 6, 2025
0ff9465
Combine PackageConfig, PackageModeConfig, and PackageInstanceConfig i…
quinntaylormitchell Nov 6, 2025
cdcfaee
Employ a 'CLPConfig'-centric approach rather than 'dict'-centric.
quinntaylormitchell Nov 6, 2025
53e7343
Store list of required components for each mode
quinntaylormitchell Nov 6, 2025
796ffe3
Generalize the method by which the mode of operation is determined.
quinntaylormitchell Nov 6, 2025
bae12de
Move all mode-related utilities to their own file.
quinntaylormitchell Nov 6, 2025
9c9ef74
Minor error.
quinntaylormitchell Nov 6, 2025
0f3dcd5
Move load_yaml_to_dict to general utilities file.
quinntaylormitchell Nov 6, 2025
f9865a8
Add taskfile tasks for package tests.
quinntaylormitchell Nov 6, 2025
865e9ed
Address rabbit comments.
quinntaylormitchell Nov 7, 2025
09d5200
Add mariadb_config install for linting purposes (will be unecessary a…
quinntaylormitchell Nov 7, 2025
5fffc32
Lint YAML.
quinntaylormitchell Nov 7, 2025
571f313
Merge branch 'main' into feature branch
quinntaylormitchell Nov 7, 2025
e348be0
Adapt code after #1549 merge.
quinntaylormitchell Nov 7, 2025
30f186f
Merge branch 'main' into feature branch
quinntaylormitchell Nov 10, 2025
e5da7e9
Merge branch 'main' into feature branch
quinntaylormitchell Nov 10, 2025
292ec70
Merge branch 'main' into feature branch
quinntaylormitchell Nov 11, 2025
0c4cfa4
Remove 'python -m'.
quinntaylormitchell Nov 11, 2025
bee738a
Address Bill-hbrhbr comments.
quinntaylormitchell Nov 12, 2025
49eaf97
Brush up docstrings.
quinntaylormitchell Nov 14, 2025
e3c4a3b
Merge branch 'main' into feature branch
quinntaylormitchell Nov 14, 2025
4cd92e6
Adapt to PascalCase ClpConfig.
quinntaylormitchell Nov 14, 2025
87c4809
Merge branch 'main' into feature branch
quinntaylormitchell Nov 17, 2025
baddcfe
Address Bill's comments; add helper function that returns a list of r…
quinntaylormitchell Nov 20, 2025
7cf597d
Rabbit.
quinntaylormitchell Nov 20, 2025
8372a9f
Refactor PackageConfig and PackageInstance classes into three separat…
quinntaylormitchell Nov 20, 2025
b92ee22
Apply suggestions from code review
Bill-hbrhbr Nov 20, 2025
f950df0
Merge branch 'main' into testing-start-stop
Bill-hbrhbr Nov 20, 2025
aac6fcb
lint fix and variable substitution
Bill-hbrhbr Nov 20, 2025
9f995b9
Update according to coderabbit AI suggestion.
Bill-hbrhbr Nov 20, 2025
03cb974
Merge branch 'main' into testing-start-stop
Bill-hbrhbr Nov 20, 2025
0e0567a
Apply Bill's comments.
quinntaylormitchell Nov 21, 2025
d44ab95
Merge branch 'main' into feature branch
quinntaylormitchell Nov 21, 2025
324ade4
Add ClpConfig data member to PackageConfig class; use 'fixt_' at begi…
quinntaylormitchell Nov 21, 2025
e7e79e1
Merge branch 'main' into feature branch
quinntaylormitchell Nov 22, 2025
7116cfc
Post-merge main.
quinntaylormitchell Nov 22, 2025
3471168
Remove return from _write_temp_config_file.
quinntaylormitchell Nov 22, 2025
a324248
Remove unecessary logging statements.
quinntaylormitchell Nov 24, 2025
6caf53a
Move content to other PRs.
quinntaylormitchell Nov 25, 2025
f3e533d
Add task for package integration tests.
quinntaylormitchell Nov 25, 2025
a71bcb0
Revert "Move content to other PRs."
quinntaylormitchell Nov 25, 2025
b5cf248
Revert "Revert "Move content to other PRs.""
quinntaylormitchell Nov 25, 2025
b496025
Revert "Add task for package integration tests."
quinntaylormitchell Nov 25, 2025
86ab692
Address Bill's comments.
quinntaylormitchell Nov 26, 2025
ce822d8
Address missed comments.
quinntaylormitchell Nov 26, 2025
8224985
Merge branch 'main' into feature branch
quinntaylormitchell Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions integration-tests/.pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ addopts =
--capture=no
--code-highlight=yes
--color=yes
-rA
--strict-config
--strict-markers
--verbose
Expand All @@ -18,3 +19,4 @@ markers =
clp: mark tests that use the CLP storage engine
clp_s: mark tests that use the CLP-S storage engine
core: mark tests that test the CLP core binaries
package: mark tests that run when the CLP package is active
7 changes: 7 additions & 0 deletions integration-tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ build-backend = "hatchling.build"

[dependency-groups]
dev = [
"clp-py-utils",
"mypy>=1.16.0",
"ruff>=0.11.12",
"pytest>=8.4.1",
"pytest-env>=1.1.5",
"PyYAML>=6.0",
"types-PyYAML>=6.0.12.20240808",
]

[tool.mypy]
strict = true
ignore_missing_imports = true

# Additional output
pretty = true
Expand Down Expand Up @@ -69,3 +73,6 @@ isort.order-by-type = false
[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 100

[tool.uv.sources]
clp-py-utils = { path = "../components/clp-py-utils" }
2 changes: 2 additions & 0 deletions integration-tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
pytest_plugins = [
"tests.fixtures.integration_test_config",
"tests.fixtures.integration_test_logs",
"tests.fixtures.package_instance_fixtures",
"tests.fixtures.package_config_fixtures",
]
9 changes: 0 additions & 9 deletions integration-tests/tests/fixtures/integration_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from tests.utils.config import (
CoreConfig,
IntegrationTestConfig,
PackageConfig,
)
from tests.utils.utils import get_env_var

Expand All @@ -20,14 +19,6 @@ def core_config() -> CoreConfig:
)


@pytest.fixture(scope="session")
def package_config() -> PackageConfig:
"""Fixture that provides a PackageConfig shared across tests."""
return PackageConfig(
clp_package_dir=Path(get_env_var("CLP_PACKAGE_DIR")).expanduser().resolve()
)


@pytest.fixture(scope="session")
def integration_test_config() -> IntegrationTestConfig:
"""Fixture that provides an IntegrationTestConfig shared across tests."""
Expand Down
70 changes: 70 additions & 0 deletions integration-tests/tests/fixtures/package_config_fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""Fixtures that create and remove temporary config files for CLP packages."""

import logging
from collections.abc import Iterator
from pathlib import Path

import pytest

from tests.utils.config import PackageConfig
from tests.utils.package_utils import (
CLP_MODE_CONFIGS,
write_temp_config_file,
)
from tests.utils.utils import get_env_var

logger = logging.getLogger(__name__)


def _build_package_config_for_mode(mode_name: str) -> PackageConfig:
"""Construct a PackageConfig for the given `mode_name`."""
if mode_name not in CLP_MODE_CONFIGS:
err_msg = f"Unknown CLP mode '{mode_name}'."
raise KeyError(err_msg)

clp_package_dir = Path(get_env_var("CLP_PACKAGE_DIR")).expanduser().resolve()
test_root_dir = Path(get_env_var("CLP_BUILD_DIR")).expanduser().resolve() / "integration-tests"

build_config = CLP_MODE_CONFIGS[mode_name][0]
required_components = CLP_MODE_CONFIGS[mode_name][1]
package_config = PackageConfig(
clp_package_dir=clp_package_dir,
test_root_dir=test_root_dir,
mode_name=mode_name,
build_config=build_config,
component_list=required_components,
)

# Write the temporary config file that the package will use.
clp_config_obj = build_config()
temp_config_file_path: Path = write_temp_config_file(
clp_config=clp_config_obj,
temp_config_dir=package_config.temp_config_dir,
mode_name=mode_name,
)
object.__setattr__(package_config, "temp_config_file_path", temp_config_file_path)

return package_config


@pytest.fixture
def clp_config(
request: pytest.FixtureRequest,
) -> Iterator[PackageConfig]:
"""
Parameterized fixture that creates and maintains a PackageConfig object for a specific mode of
operation.
"""
mode_name: str = request.param
logger.info("Creating a temporary config file for the %s package...", mode_name)

package_config = _build_package_config_for_mode(mode_name)

logger.info("The temporary config file has been written for the %s package.", mode_name)

try:
yield package_config
finally:
logger.info("Removing the temporary config file...")
package_config.temp_config_file_path.unlink()
logger.info("The temporary config file has been removed.")
50 changes: 50 additions & 0 deletions integration-tests/tests/fixtures/package_instance_fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""Fixtures that start and stop CLP package instances for integration tests."""

import logging
import subprocess
from collections.abc import Iterator

import pytest

from tests.utils.config import (
PackageConfig,
PackageInstance,
)
from tests.utils.package_utils import (
start_clp_package,
stop_clp_package,
)

logger = logging.getLogger(__name__)


@pytest.fixture
def clp_package(
clp_config: PackageConfig,
) -> Iterator[PackageInstance]:
"""
Parameterized fixture that starts a instance of the CLP package in the configuration described
in PackageConfig, and gracefully stops it at teardown.
"""
mode_name = clp_config.mode_name
logger.info("Starting up the %s package...", mode_name)

start_clp_package(clp_config)

try:
instance = PackageInstance(package_config=clp_config)
instance_id = instance.clp_instance_id
logger.info(
"An instance of the %s package was started successfully. Its instance ID is '%s'",
mode_name,
instance_id,
)
yield instance
finally:
logger.info("Now stopping the %s package...", mode_name)
if instance is not None:
stop_clp_package(instance)
else:
# This means setup failed after start; fall back to calling stop script directly
subprocess.run([str(clp_config.stop_script_path)], check=True)
logger.info("The %s package was stopped successfully.", mode_name)
65 changes: 65 additions & 0 deletions integration-tests/tests/test_package_start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""Integration tests verifying that the CLP package can be started and stopped."""

import logging

import pytest

from tests.utils.config import PackageInstance
from tests.utils.package_utils import (
CLP_MODE_CONFIGS,
is_package_running,
is_running_mode_correct,
)

TEST_MODES = CLP_MODE_CONFIGS.keys()

logger = logging.getLogger(__name__)


@pytest.mark.package
@pytest.mark.parametrize("clp_config", TEST_MODES, indirect=True)
def test_clp_package(clp_package: PackageInstance) -> None:
"""
Validate that all of the components of the CLP package start up successfully for the selected
mode of operation.
"""
# Spin up the package by getting the PackageInstance fixture.
package_instance = clp_package
mode_name = package_instance.package_config.mode_name
instance_id = package_instance.clp_instance_id

# Ensure that all package components are running.
logger.info(
"Checking if all components of %s package with instance ID '%s' are running properly...",
mode_name,
instance_id,
)

running, fail_msg = is_package_running(package_instance)
if not running:
assert fail_msg is not None
pytest.fail(fail_msg)

logger.info(
"All components of the %s package with instance ID '%s' are running properly.",
mode_name,
instance_id,
)

# Ensure that the package is running in the correct mode.
logger.info(
"Checking that the %s package with instance ID '%s' is running in the correct mode...",
mode_name,
instance_id,
)

correct, fail_msg = is_running_mode_correct(package_instance)
if not correct:
assert fail_msg is not None
pytest.fail(fail_msg)

logger.info(
"The %s package with instance ID '%s' is running in the correct mode.",
mode_name,
instance_id,
)
Loading
Loading