Skip to content

Commit 104009c

Browse files
committed
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 c1bfd54 commit 104009c

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
@@ -3482,6 +3482,11 @@ def wait_for_schema_agreement(self, wait_time: Optional[float] = None,
34823482
if wait_time is not None and wait_time <= 0:
34833483
raise ValueError("wait_time must be greater than 0")
34843484

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

0 commit comments

Comments
 (0)