diff --git a/test/cql-pytest/test_service_levels.py b/test/cql-pytest/test_service_levels.py index 9b0685d1d2..038fd8ee9b 100644 --- a/test/cql-pytest/test_service_levels.py +++ b/test/cql-pytest/test_service_levels.py @@ -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}'") \ No newline at end of file