From 06f6aaf2cf9eb04d5f6468bd9f0764458fb37805 Mon Sep 17 00:00:00 2001 From: Aleksandra Martyniuk Date: Fri, 22 Mar 2024 11:47:18 +0100 Subject: [PATCH] test: check default value of tombstone_gc Add a test which checks whether default tombstone_gc value is properly set and if it does not override previous setting. --- .../test_tombstone_gc.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/topology_experimental_raft/test_tombstone_gc.py diff --git a/test/topology_experimental_raft/test_tombstone_gc.py b/test/topology_experimental_raft/test_tombstone_gc.py new file mode 100644 index 0000000000..125becceac --- /dev/null +++ b/test/topology_experimental_raft/test_tombstone_gc.py @@ -0,0 +1,39 @@ +# +# Copyright (C) 2024-present ScyllaDB +# +# SPDX-License-Identifier: AGPL-3.0-or-later +# +import logging +import pytest + +from test.topology.util import new_test_keyspace, new_test_table + +logger = logging.getLogger(__name__) + +def check_tombstone_gc_mode(cql, table, mode): + s = list(cql.execute(f"DESC {table}"))[0].create_statement + assert f"'mode': '{mode}'" in s + +def get_expected_tombstone_gc_mode(rf, tablets): + return "repair" if tablets and rf > 1 else "timeout" + +@pytest.mark.asyncio +@pytest.mark.parametrize("rf", [1, 2]) +@pytest.mark.parametrize("tablets", ["true", "false"]) +async def test_default_tombstone_gc(manager, rf, tablets): + servers = [await manager.server_add(), await manager.server_add()] + cql = manager.cql + async with new_test_keyspace(cql, f"with replication = {{ 'class': 'NetworkTopologyStrategy', 'replication_factor': {rf}}} and tablets = {{'initial': {rf}}}") as keyspace: + async with new_test_table(cql, keyspace, "p int primary key, x int") as table: + check_tombstone_gc_mode(cql, table, get_expected_tombstone_gc_mode(rf, tablets)) + +@pytest.mark.asyncio +@pytest.mark.parametrize("rf", [1, 2]) +@pytest.mark.parametrize("tablets", ["true", "false"]) +async def test_default_tombstone_gc_does_not_override(manager, rf, tablets): + servers = [await manager.server_add(), await manager.server_add()] + cql = manager.cql + async with new_test_keyspace(cql, f"with replication = {{ 'class': 'NetworkTopologyStrategy', 'replication_factor': {rf}}} and tablets = {{'initial': {rf}}}") as keyspace: + async with new_test_table(cql, keyspace, "p int primary key, x int", " with tombstone_gc = {'mode': 'disabled'}") as table: + await cql.run_async(f"ALTER TABLE {table} add y int") + check_tombstone_gc_mode(cql, table, "disabled")