Skip to content

Commit

Permalink
rptest: add test_validate_cloud_storage_cache_size_config
Browse files Browse the repository at this point in the history
  • Loading branch information
WillemKauf committed Sep 17, 2024
1 parent 9e8b9c4 commit 62570f1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/rptest/tests/cluster_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,36 @@ def test_validate_cloud_storage_api_endpoint(self, value, valid):
#Valid api endpoint
assert valid

# None for pct_value is std::nullopt, which defaults to 0.0 in the cloud cache.
@cluster(num_nodes=3)
@parametrize(size_value=0, pct_value=None, valid=False)
@parametrize(size_value=0, pct_value=0.0, valid=False)
@parametrize(size_value=0, pct_value=-1.0, valid=False)
@parametrize(size_value=0, pct_value=101.0, valid=False)
@parametrize(size_value=-1, pct_value=None, valid=False)
@parametrize(size_value=1024, pct_value=None, valid=True)
@parametrize(size_value=10, pct_value=50.0, valid=True)
@parametrize(size_value=0, pct_value=0.1, valid=True)
def test_validate_cloud_storage_cache_size_config(self, size_value,
pct_value, valid):
upsert = {}
upsert["cloud_storage_cache_size"] = size_value
upsert["cloud_storage_cache_size_percent"] = pct_value

if valid:
patch_result = self.admin.patch_cluster_config(upsert=upsert)
new_version = patch_result['config_version']
wait_for_version_status_sync(self.admin, self.redpanda,
new_version)
updated_config = self.admin.get_cluster_config()
assert updated_config["cloud_storage_cache_size"] == size_value
assert updated_config[
"cloud_storage_cache_size_percent"] == pct_value
else:
with expect_exception(requests.exceptions.HTTPError,
lambda e: e.response.status_code == 400):
self.admin.patch_cluster_config(upsert=upsert)


"""
PropertyAliasData:
Expand Down

0 comments on commit 62570f1

Please sign in to comment.