test: cqlpy: add test case for non-numeric PERCENTILE value
Add test case for non-numeric PERCENTILE value, which raises an error
different to the out-of-range invalid values. Regex in the test
test_invalid_percentile_speculative_retry_values is expanded.
Refs #26369
(cherry picked from commit 7ec9e23ee3)
This commit is contained in:
committed by
GitHub Action
parent
d9ce2f5e43
commit
30d615e76c
@@ -88,7 +88,7 @@ def test_valid_percentile_speculative_retry_values(cql, test_keyspace, percentil
|
||||
with new_test_table(cql, test_keyspace, "id UUID PRIMARY KEY, value TEXT") as table:
|
||||
cql.execute(f"ALTER TABLE {table} WITH speculative_retry = '{percentile}PERCENTILE'")
|
||||
|
||||
@pytest.mark.parametrize("percentile", ["-1.1", "-1", "-0.1", "-0.01", "-0.001", "100.1", "100.01", "100.001", "101", "+101", "+101.1"])
|
||||
@pytest.mark.parametrize("percentile", ["-1.1", "-1", "-0.1", "-0.01", "-0.001", "100.1", "100.01", "100.001", "101", "+101", "+101.1", "dog"])
|
||||
def test_invalid_percentile_speculative_retry_values(cql, test_keyspace, percentile):
|
||||
"""
|
||||
In test_invalid_percentile_speculative_retry_values, we verify that invalid values for the
|
||||
@@ -103,12 +103,18 @@ def test_invalid_percentile_speculative_retry_values(cql, test_keyspace, percent
|
||||
See issue #21825.
|
||||
"""
|
||||
|
||||
percentile = percentile.upper()
|
||||
|
||||
# For negative values and zero, Cassandra returns a shortened error message compared to ScyllaDB.
|
||||
# Therefore, a regular expression is used to match both formats of the error message.
|
||||
message = (
|
||||
f"(?:"
|
||||
f"Invalid value {re.escape(percentile)}PERCENTILE "
|
||||
r"for (?:PERCENTILE option|option) 'speculative_retry'"
|
||||
r"(?:\: must be between \(0\.0 and 100\.0\))?"
|
||||
f"|"
|
||||
f"cannot convert {re.escape(percentile)}PERCENTILE to speculative_retry"
|
||||
f")"
|
||||
)
|
||||
with new_test_table(cql, test_keyspace, "id UUID PRIMARY KEY, value TEXT") as table:
|
||||
with pytest.raises(ConfigurationException, match=message):
|
||||
|
||||
Reference in New Issue
Block a user