feat(integration-tests): Record required components in PackageConfig based on the CLP package config.#1658
Conversation
…ig file; address comments.
…er-level clp-config.yml
…E_CONFIGS other than clp-text and clp-json
WalkthroughA utility to compute required CLP components from a CLP config was added; Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Ruff (0.14.7)integration-tests/tests/test_package_start.py�[1;31mruff failed�[0m integration-tests/tests/utils/clp_mode_utils.py�[1;31mruff failed�[0m Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
component_list data member to PackageConfig data class.component_list data member within PackageConfig.
| # Get the ClpConfig for this mode. | ||
| clp_config_obj = get_clp_config_from_mode(mode_name) | ||
|
|
||
| # Compute the list of required components for this mode. |
There was a problem hiding this comment.
these comments feel a bit redundant since the method names have been pretty self-explanatory
| # Get the ClpConfig for this mode. | |
| clp_config_obj = get_clp_config_from_mode(mode_name) | |
| # Compute the list of required components for this mode. | |
| clp_config_obj = get_clp_config_from_mode(mode_name) |
There was a problem hiding this comment.
will remove.
| package_config = PackageConfig( | ||
| path_config=fixt_package_path_config, | ||
| mode_name=mode_name, | ||
| component_list=required_components, |
There was a problem hiding this comment.
it's not immediately clear how the component_list would be used yet. just want to make they are logged before they are used for better traceability in the tests
There was a problem hiding this comment.
I'll log the list of components in test_package_start.py for now.
| _to_docker_compose_service_name(WEBUI_COMPONENT_NAME), | ||
| ] | ||
|
|
||
| CLP_QUERY_COMPONENTS = [ |
There was a problem hiding this comment.
i believe the Presto coordinator is left out intentionally. shall we add a comment / TODO to explain why it's not listed as a component in the integration tests for now, and that we plan to add it, once we integrate the Presto Docker Compose project with the CLP Docker Compose project?
There was a problem hiding this comment.
It is left out intentionally. Will add the TODO as you describe.
| CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME) | ||
|
|
||
| CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME) | ||
|
|
||
| CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME) |
There was a problem hiding this comment.
| CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME) | |
| CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME) | |
| CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME) | |
| CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME) | |
| CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME) | |
| CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME) |
junhaoliao
left a comment
There was a problem hiding this comment.
for the title, how about
feat(integration-tests): Record required components in `PackageConfig` based on the CLP package config.
component_list data member within PackageConfig.PackageConfig based on the CLP package config.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
integration-tests/tests/test_package_start.py(1 hunks)integration-tests/tests/utils/clp_mode_utils.py(3 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Bill-hbrhbr
Repo: y-scope/clp PR: 1100
File: integration-tests/tests/fixtures/integration_test_logs.py:54-56
Timestamp: 2025-08-17T16:10:38.722Z
Learning: For PR #1100 (feat(integration-tests): Add CLP package integration tests boilerplate), do not raise cache weakness problems related to the pytest cache implementation in the integration test logs fixtures.
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1405
File: components/clp-package-utils/pyproject.toml:5-15
Timestamp: 2025-10-13T03:24:35.074Z
Learning: In the y-scope/clp repository, the Python 3.9 to 3.10 version requirement change was intentionally deferred to a separate PR (after PR #1405) to reduce review effort, as decided in an offline discussion between junhaoliao and kirkrodrigues.
📚 Learning: 2025-11-10T05:19:56.600Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1575
File: components/clp-py-utils/clp_py_utils/clp_config.py:602-607
Timestamp: 2025-11-10T05:19:56.600Z
Learning: In the y-scope/clp repository, the `ApiServer` class in `components/clp-py-utils/clp_py_utils/clp_config.py` does not need a `transform_for_container()` method because no other containerized service depends on the API server - it's only accessed from the host, so no docker-network communication is expected.
Applied to files:
integration-tests/tests/utils/clp_mode_utils.py
📚 Learning: 2025-10-27T07:07:37.901Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1501
File: tools/deployment/presto-clp/scripts/init.py:10-13
Timestamp: 2025-10-27T07:07:37.901Z
Learning: In `tools/deployment/presto-clp/scripts/init.py`, the `DATABASE_COMPONENT_NAME` and `DATABASE_DEFAULT_PORT` constants are intentionally duplicated from `clp_py_utils.clp_config` because `clp_py_utils` is not installed in the Presto init script's runtime environment. The two flows are separate and this duplication is documented. There are plans to merge these flows after a future release.
Applied to files:
integration-tests/tests/utils/clp_mode_utils.py
🧬 Code graph analysis (2)
integration-tests/tests/test_package_start.py (1)
integration-tests/tests/fixtures/package_instance.py (1)
fixt_package_instance(18-34)
integration-tests/tests/utils/clp_mode_utils.py (1)
components/clp-py-utils/clp_py_utils/clp_config.py (5)
ClpConfig(713-963)DeploymentType(95-97)Package(150-174)QueryEngine(126-129)get_deployment_type(915-918)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: package-image
- GitHub Check: build (ubuntu-24.04)
- GitHub Check: lint-check (ubuntu-24.04)
- GitHub Check: lint-check (macos-15)
🔇 Additional comments (2)
integration-tests/tests/test_package_start.py (1)
27-31: Component logging wiring looks correct and helpful for debugging.Using
package_config.component_listand logging it as a newline‑joined list under the mode name is straightforward and keeps the output readable. This should make it much easier to see which services are expected to be running for a given package mode.integration-tests/tests/utils/clp_mode_utils.py (1)
91-117: Required component computation matches current deployment semantics.Initialising
component_listfromCLP_BASE_COMPONENTS, then extending withCLP_QUERY_COMPONENTSonly forDeploymentType.FULL, and conditionally adding API server, garbage collector, and MCP server based on the presence/retention settings on the config, matches the describedClpConfig.get_deployment_type()and component behaviour. The logic is straightforward, side‑effect free on the constants, and should give a stable, predictable component list for the tests to log and eventually validate against.
| # TODO: This will eventually be replaced by a formalized mapping between component and service. | ||
| def _to_docker_compose_service_name(name: str) -> str: | ||
| """ | ||
| Convert a component name to a Docker Compose service name. | ||
|
|
||
| :param name: | ||
| :return: Service name with underscores replaced by hyphens | ||
| """ | ||
| return name.replace("_", "-") | ||
|
|
||
|
|
||
| # TODO: Modify these component lists when the Presto Docker Compose project is integrated with the | ||
| # CLP Docker compose project. | ||
| CLP_BASE_COMPONENTS = [ | ||
| _to_docker_compose_service_name(DB_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(QUEUE_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(REDIS_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(REDUCER_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(RESULTS_CACHE_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(COMPRESSION_SCHEDULER_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(COMPRESSION_WORKER_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(WEBUI_COMPONENT_NAME), | ||
| ] | ||
|
|
||
| CLP_QUERY_COMPONENTS = [ | ||
| _to_docker_compose_service_name(QUERY_SCHEDULER_COMPONENT_NAME), | ||
| _to_docker_compose_service_name(QUERY_WORKER_COMPONENT_NAME), | ||
| ] | ||
|
|
||
| CLP_API_SERVER_COMPONENT = _to_docker_compose_service_name(API_SERVER_COMPONENT_NAME) | ||
| CLP_GARBAGE_COLLECTOR_COMPONENT = _to_docker_compose_service_name(GARBAGE_COLLECTOR_COMPONENT_NAME) | ||
| CLP_MCP_SERVER_COMPONENT = _to_docker_compose_service_name(MCP_SERVER_COMPONENT_NAME) | ||
|
|
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Component → service-name mapping and constants are clear; consider immutable sequences.
The _to_docker_compose_service_name() helper plus the centralised CLP_* component constants give a single place to reason about docker‑compose service names, which will make future config/debugging much easier. The TODO around Presto/Compose integration also documents the current omission appropriately (consistent with earlier decisions about separate Presto flows). Based on learnings, this aligns with the current deployment split.
If you want to tighten this further, you could make CLP_BASE_COMPONENTS and CLP_QUERY_COMPONENTS tuples instead of lists to emphasise that they are constants and should not be mutated, relying on list(CLP_BASE_COMPONENTS) in get_required_component_list() as you already do.
🤖 Prompt for AI Agents
In integration-tests/tests/utils/clp_mode_utils.py around lines 43 to 75, the
CLP_BASE_COMPONENTS and CLP_QUERY_COMPONENTS are defined as mutable lists but
intended to be constants; change both to tuples (e.g. replace [...] with (...))
so they are immutable, keep the helper _to_docker_compose_service_name usage the
same, and ensure any call sites that expect a list continue to call
list(CLP_BASE_COMPONENTS) or list(CLP_QUERY_COMPONENTS) as needed (no other
behavior changes required).
Bill-hbrhbr
left a comment
There was a problem hiding this comment.
Leaving to @junhaoliao for final pass and PR title suggestion.
…` based on the CLP package config. (y-scope#1658) Co-authored-by: Bingran Hu <bingran.hu@yscope.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Description
This PR introduces the
component_listdata member toPackageConfigdata class. The data member is used for tracking which containerized components a given CLP package configuration needs to run.PR dependencies
This PR depends on the following being merged:
Checklist
breaking change.
Validation performed
Ran the following command from
clp/integration-tests:uv run pytest -m 'package'Both the
clp-jsonandclp-texttests passed.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.