mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-03 05:26:58 +00:00
cql-pytest: add basic tests for service level workload types
The test cases check whether it's possible to declare workload type for a service level and if its input is validated.
This commit is contained in:
@@ -68,3 +68,21 @@ def test_attached_service_level(scylla_only, cql):
|
||||
assert res_one.role == cql.cluster.auth_provider.username and res_one.service_level == sl
|
||||
res_one = cql.execute(f"LIST ALL ATTACHED SERVICE LEVELS").one()
|
||||
assert res_one.role == cql.cluster.auth_provider.username and res_one.service_level == sl
|
||||
|
||||
# Test that declaring service level workload types is possible
|
||||
def test_set_workload_type(scylla_only, cql):
|
||||
with new_service_level(cql) as sl:
|
||||
res = cql.execute(f"LIST SERVICE LEVEL {sl}")
|
||||
assert res.one().workload_type == 'unspecified'
|
||||
for wt in ['interactive', 'batch', 'unspecified']:
|
||||
cql.execute(f"ALTER SERVICE LEVEL {sl} WITH workload_type = '{wt}'")
|
||||
res = cql.execute(f"LIST SERVICE LEVEL {sl}")
|
||||
assert res.one().workload_type == wt
|
||||
|
||||
# Test that workload type input is validated
|
||||
def test_set_invalid_workload_types(scylla_only, cql):
|
||||
with new_service_level(cql) as sl:
|
||||
for incorrect in ['', 'null', 'i', 'b', 'dog', 'x'*256]:
|
||||
print(f"Checking {incorrect}")
|
||||
with pytest.raises(Exception):
|
||||
cql.execute(f"ALTER SERVICE LEVEL {sl} WITH workload_type = '{incorrect}'")
|
||||
Reference in New Issue
Block a user