refactor(nemesis): Remove Class:N count syntax from nemesis_class_name, enforce explicit list format#14256
Open
cezarmoise wants to merge 1 commit intoscylladb:masterfrom
Open
refactor(nemesis): Remove Class:N count syntax from nemesis_class_name, enforce explicit list format#14256cezarmoise wants to merge 1 commit intoscylladb:masterfrom
Class:N count syntax from nemesis_class_name, enforce explicit list format#14256cezarmoise wants to merge 1 commit intoscylladb:masterfrom
Conversation
Contributor
Author
|
@claude review this change please |
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
✅ Test Summary: PASSED✅ Precommit: PASSED
✅ Tests: PASSED
|
pehala
reviewed
Mar 30, 2026
Contributor
Author
|
Temporarily marked as draft as I want to improve further. |
Class:N count syntax from nemesis_class_name, enforce explicit list format
5fdf9c4 to
caaf058
Compare
… format - nemesis_class_name now accepts only plain class names or explicit YAML lists; the former 'Class:N' count syntax and space-separated strings both raise ValueError with a migration hint - nemesis_selector / nemesis_seed: single value broadcasts to all threads; N-element list maps 1:1 to class names; mismatched lengths raise ValueError at config-load time (_validate_nemesis_parallel_config) - NemesisRunner.nemesis_selector: None (not set) falls back to config for direct-instantiation paths (sct.py nemesis-list); explicit "" means "run all nemeses" - Convert 12 YAML test-case files from count/space syntax to explicit lists - Update docs and unit tests for new API (14 tests, all passing) Co-authored-by: Claude <claude@anthropic.com>
caaf058 to
047d915
Compare
cezarmoise
commented
Mar 31, 2026
| gce_n_local_ssd_disk_db: 8 | ||
|
|
||
| nemesis_class_name: 'SisyphusMonkey' | ||
| nemesis_selector: ["topology_changes", "schema_changes and not disruptive"] |
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
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.
Parallel nemesis runs using the space-separated
nemesis_class_nameformat (e.g.'SisyphusMonkey:1 SisyphusMonkey:1') were silently broken after the pydantic config migration (aa9cd75).See https://argus.scylladb.com/tests/scylla-cluster-tests/1b6ed4e9-2c22-4153-94c4-3081d46c28d1/nemesis
Only 1 nemesis thread ran.
Summary
Replaces the implicit count/space-separated syntax for running parallel nemesis threads with an
explicit YAML list. Adds validation so misconfigurations are caught at config-load time rather
than producing silent surprises at runtime.
Problem
The old
nemesis_class_namesyntax accepted three formats simultaneously:This made
nemesis_selectorandnemesis_seedassignment opaque: if you had two threads andone selector, was the selector applied to thread 0 only, or broadcast? The code used
selectors[i % len(class_names)], which silently cycled through selectors in ways that werehard to reason about.
Changes
sdcm/tester.py—get_nemesis_class()Class:Ncount expansion loop is removed.ValueErroris raised if any entry innemesis_class_namecontains:(countsyntax) or a space (space-separated format), with a clear migration message.
Noneper threadnemesis_class_name) → 1:1 mapping, enforced by config validatorsdcm/sct_config.pynemesis_class_namefield description updated to document the new list-only API andexplicitly deprecate the old syntax.
_validate_nemesis_parallel_config()method validates that multi-elementnemesis_selectorandnemesis_seedlists match the number of entries innemesis_class_name. Mismatches raiseValueErrorwith a helpful error message atconfig-load time. Called unconditionally from
verify_configuration().sdcm/nemesis/__init__.py—NemesisRunner.nemesis_selector__init__parameter typed asOptional[str] = None.Noneas the sentinel for "not explicitly set" (replaces the old truthinesscheck that treated
""identically toNone).None→ falls back tocluster.params.get("nemesis_selector"), enabling directinstantiation paths such as
sct.py nemesis-listto pick up the config value.""→ explicitly means "run all nemeses, no filtering".list(takes[0]) andstr/Nonereturn types from params.sdcm/utils/operations_thread.pyisinstance(nemesis_seed, str)branch (theIntOrListtype already resolvesseeds to
intorlist[int]; string seeds no longer reach this code).Random()seed guard from truthiness tois not Noneso that seed value0isnot silently discarded.
YAML test-case files converted
All occurrences of
Class:Nand space-separatednemesis_class_nameare replaced withexplicit YAML lists. Two files also had
nemesis_seedvalues in the old space-separatedstring format, converted to proper YAML lists/integers.
Migration guide
Before:
After:
If you use
nemesis_selectorornemesis_seedwith multiple threads, the valid forms are:Any mismatch in list lengths will raise a
ValueErrorat config-load time with adescriptive message showing both lists.
Testing
PR pre-checks (self review)
backportlabelsReminders
sdcm/sct_config.py)unit-test/folder)