Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

Plan to add build mode support for relocatable packages

  • Investigate current code and understand the issue
  • Modify ScyllaCluster.init to extract build_mode from relocatable packages
  • Modify ScyllaCluster to set timeouts after mode is extracted
  • Add tests to verify build mode extraction for relocatable packages
  • Run tests to ensure changes work correctly
  • Address code review feedback - use tmp_path fixture
  • Address code review feedback - use parametrize for test cases
  • Request code review

Summary of Changes

Problem: Relocatable packages had scylla_mode hardcoded to None, which prevented proper support for different build types (debug/dev/release).

Solution:

  1. Modified ScyllaCluster.__init__ (ccmlib/scylla_cluster.py):

    • When both install_dir and cassandra_version are provided (e.g., when loading a cluster from disk), the build mode is now extracted from the install directory using scylla_extract_install_dir_and_mode()
    • The existing mode extraction logic was already present in load_from_repository(), but wasn't being used when loading from disk
  2. Fixed timeout calculation:

    • Moved __set_default_timeouts() call to after Cluster.__init__() to ensure scylla_mode is properly set before calculating timeouts
    • Debug builds now correctly get longer timeouts (600s/900s) instead of shorter ones (120s/420s)
  3. Added comprehensive tests (tests/test_build_mode_extraction.py):

    • Verify build mode extraction for debug, dev, and release modes
    • Verify correct timeout values for each build mode
    • All existing tests still pass
    • Updated to use tmp_path pytest fixture per code review
    • Updated to use @pytest.mark.parametrize for better test isolation

Impact: Relocatable packages now properly support different build modes (debug/dev/release), with appropriate timeout values for each mode.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for different build modes when using relocatable packages</issue_title>
<issue_description>Relocatable package has build_mode='reloc' hardcoded, we should fix it to support the real types (dev/debug/release), once we'll have those types of packages</issue_description>

<agent_instructions>Check if this is still the case, and suggest a fix and wait</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Modified ScyllaCluster.__init__ to extract build mode from install_dir when both install_dir and cassandra_version are provided
- Moved __set_default_timeouts() call after parent init to ensure scylla_mode is properly set
- Added comprehensive tests for build mode extraction with different modes (debug, dev, release)
- All existing tests pass

Co-authored-by: fruch <[email protected]>
Copilot AI changed the title [WIP] Add support for different build modes in relocatable packages Extract build mode from relocatable packages for proper timeout configuration Dec 24, 2025
Copilot AI requested a review from fruch December 24, 2025 20:53
def test_scylla_cluster_init_extracts_mode_from_install_dir():
"""Test that ScyllaCluster.__init__ extracts build mode from install_dir when cassandra_version is also provided."""

with tempfile.TemporaryDirectory() as tmpdir:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

there a pytest fixture for this, please use that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use the tmp_path pytest fixture in commit 38a90c9.

"""Test that timeouts are correctly set based on build mode."""

with tempfile.TemporaryDirectory() as tmpdir:
test_cases = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use parmeterize for those cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use @pytest.mark.parametrize in commit 3d35f1b. The test now runs as 3 separate test instances (one for each mode: debug, release, dev).

Replaced manual tempfile usage with the tmp_path pytest fixture
as suggested in code review. This is the standard pytest approach
for temporary directories and is more consistent with other tests
in the repository.

Co-authored-by: fruch <[email protected]>
"""
Test that build modes are correctly extracted from relocatable packages.
"""
from pathlib import Path
Refactored test_scylla_cluster_timeout_settings to use @pytest.mark.parametrize
instead of a for loop. This creates 3 separate test instances (one for each mode)
which provides better test isolation and clearer output when tests fail.

Co-authored-by: fruch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for different build modes when using relocatable packages

2 participants