-
Notifications
You must be signed in to change notification settings - Fork 72
DTEST-1 Infer datacenter from existing nodes when adding without explicit datacenter #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
7
commits into
master
Choose a base branch
from
copilot/fix-new-node-data-center
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+171
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copilot
AI
changed the title
[WIP] Fix issue with adding new node to cluster without data center
Fix topology file creation when adding nodes without explicit datacenter
Dec 24, 2025
fruch
requested changes
Dec 24, 2025
Copilot
AI
changed the title
Fix topology file creation when adding nodes without explicit datacenter
Infer datacenter from existing nodes when adding without explicit datacenter
Dec 24, 2025
fruch
reviewed
Dec 25, 2025
c4908d5 to
6d9f35c
Compare
6d9f35c to
d2be848
Compare
fruch
approved these changes
Jan 15, 2026
Contributor
fruch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
Previously, __update_topology_files() was only called when data_center was explicitly provided. This caused issues when adding nodes without specifying data_center, as the cassandra-rackdc.properties file would not be created with default values (dc1, RAC1). The fix moves __update_topology_files() outside the data_center check, ensuring topology files are always updated. The method itself handles None values by using defaults. Fixes issue: "Can't add new node to the cluster if I don't specify data-center explicitly." Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
Instead of always defaulting to dc1, the add() method now looks at existing nodes and infers the datacenter from them when not explicitly specified. This ensures that new nodes added to a cluster inherit the datacenter of existing nodes, which is more intuitive behavior. - If datacenter is not specified and there are existing nodes with a datacenter, use theirs - Also infer rack from existing nodes if not specified - Updated tests to verify the new inference behavior Addresses review feedback from @fruch Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
Switch from class-based tests to function-based tests using pytest fixtures to minimize code duplication and follow pytest best practices: - Use @pytest.fixture for setup (temp_dir, mock_cluster, mock_node) - Convert class methods to standalone test functions - Remove manual try/finally cleanup in favor of fixture teardown - Create factory fixture (mock_node) for creating multiple mock nodes This makes tests more readable and maintainable while keeping the same test coverage and assertions. Co-authored-by: fruch <340979+fruch@users.noreply.github.com>
This reverts commit 8e79170.
Switch from class-based tests to function-based tests using pytest fixtures to minimize code duplication and follow pytest best practices: - Use @pytest.fixture for setup (temp_dir, mock_cluster, mock_node) - Convert class methods to standalone test functions - Remove manual try/finally cleanup in favor of fixture teardown - Create factory fixture (mock_node) for creating multiple mock nodes This makes tests more readable and maintainable while keeping the same test coverage and assertions.
Document best practices for writing tests in scylla-ccm: - Use function-based tests with pytest fixtures - Create reusable fixtures to minimize code duplication - Use @pytest.fixture decorator for setup/teardown - Prefer fixtures over manual try/finally blocks This provides guidance for contributors to write tests that follow the project's conventions and pytest best practices.
d2be848 to
27f6eb1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed the issue by making the
add()method infer datacenter from existing nodes when not explicitly specified. Refactored tests to use pytest best practices with fixtures instead of class-based tests. Added pytest style guidelines to copilot instructions in separate commits as requested.Commit Structure
Changes
Tests now follow pytest best practices with function-based tests and reusable fixtures.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.