Skip to content

Commit

Permalink
tests: add tests for the selection of SI modes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Lazar committed Oct 7, 2022
1 parent 3773134 commit dbb3989
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/rptest/tests/topic_creation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,50 @@ def test_create_topic_with_single_configuration_property(self):
cfgs = rpk.describe_topic_configs(topic=name)
assert str(cfgs[p][0]) == str(property_value)

@cluster(num_nodes=3)
@matrix(cloud_storage_enable_remote_read=[True, False],
cloud_storage_enable_remote_write=[True, False],
topic_remote_read=[True, False, None],
topic_remote_write=[True, False, None])
def test_shadow_indexing_mode(self, cloud_storage_enable_remote_read,
cloud_storage_enable_remote_write,
topic_remote_read, topic_remote_write):
to_bool = lambda x: True if x == "true" else False
from_bool = lambda x: "true" if x else "false"

rpk = RpkTool(self.redpanda)

expected_read = topic_remote_read if topic_remote_read is not None \
else cloud_storage_enable_remote_read
expected_write = topic_remote_write if topic_remote_write is not None \
else cloud_storage_enable_remote_write

self.redpanda.set_cluster_config(
{
"cloud_storage_enable_remote_read":
cloud_storage_enable_remote_read,
"cloud_storage_enable_remote_write":
cloud_storage_enable_remote_write
},
expect_restart=True)

config = {}
if topic_remote_read is not None:
config["redpanda.remote.read"] = from_bool(topic_remote_read)
if topic_remote_write is not None:
config["redpanda.remote.write"] = from_bool(topic_remote_write)

topic = self._topic_name()
rpk.create_topic(topic=topic, partitions=1, replicas=3, config=config)

ret = rpk.describe_topic_configs(topic=topic)


read = to_bool(ret["redpanda.remote.read"][0])
write = to_bool(ret["redpanda.remote.write"][0])
assert read == expected_read, f"{read} != {expected_read}"
assert write == expected_write, f"{write} != {expected_write}"


# When quickly recreating topics after deleting them, redpanda's topic
# dir creation can trip up over the topic dir deletion. This is not
Expand Down

0 comments on commit dbb3989

Please sign in to comment.