Skip to content

Commit 03c4c96

Browse files
mykauldkropachev
authored andcommitted
fix: add missing scope validation in Session.wait_for_schema_agreement
The docstring and test promised ValueError for invalid scope values (e.g. 'planet'), but the validation was never implemented in the method body. Add an explicit check against the three SchemaAgreementScope members. Introduced in commit 0d215f4 (cluster: add Session.wait_for_schema_agreement).
1 parent 6471abe commit 03c4c96

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

cassandra/cluster.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3481,6 +3481,11 @@ def wait_for_schema_agreement(self, wait_time: Optional[float] = None,
34813481
if wait_time is not None and wait_time <= 0:
34823482
raise ValueError("wait_time must be greater than 0")
34833483

3484+
if scope not in (SchemaAgreementScope.RACK, SchemaAgreementScope.DC, SchemaAgreementScope.CLUSTER):
3485+
raise ValueError(
3486+
"scope must be SchemaAgreementScope.RACK, .DC, or .CLUSTER"
3487+
)
3488+
34843489
total_timeout = wait_time if wait_time is not None else self.cluster.max_schema_agreement_wait
34853490
if total_timeout <= 0:
34863491
raise ValueError("total_timeout must be greater than 0")

0 commit comments

Comments
 (0)