From b6c8ad344881e0c013e6d368f26fb7017c178a17 Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 22 Dec 2022 13:25:42 +0000 Subject: [PATCH] tests: add test for AlterConfig redpanda.remote properties --- tests/rptest/tests/topic_creation_test.py | 34 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/tests/rptest/tests/topic_creation_test.py b/tests/rptest/tests/topic_creation_test.py index 7726906ee629..e9a5dfe3c946 100644 --- a/tests/rptest/tests/topic_creation_test.py +++ b/tests/rptest/tests/topic_creation_test.py @@ -8,7 +8,6 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0 -from enum import Enum import random import string import itertools @@ -24,7 +23,8 @@ from rptest.services.redpanda_installer import RedpandaInstaller from rptest.services.rpk_producer import RpkProducer from rptest.clients.kafka_cli_tools import KafkaCliTools -from rptest.util import wait_for_segments_removal +from rptest.util import wait_for_segments_removal, expect_exception +from rptest.clients.kcl import KCL from ducktape.utils.util import wait_until from ducktape.mark import matrix, parametrize @@ -331,6 +331,36 @@ def test_shadow_indexing_mode_persistence(self): assert explicit_si_configs["redpanda.remote.write"] == ( "false", "DYNAMIC_TOPIC_CONFIG") + @cluster(num_nodes=1) + def topic_alter_config_test(self): + """ + Intentionally use the legacy (deprecated in Kafka 2.3.0) AlterConfig + admin RPC, to check it works with our custom topic properties + """ + rpk = RpkTool(self.redpanda) + topic = topic_name() + rpk.create_topic(topic=topic, partitions=1, replicas=1) + + # Older KCL has support for the legacy AlterConfig RPC: latest rpk and kafka CLI do not. + kcl = KCL(self.redpanda) + + examples = { + 'redpanda.remote.delete': 'true', + 'redpanda.remote.write': 'true', + 'redpanda.remote.read': 'true', + 'retention.local.target.bytes': '123456', + 'retention.local.target.ms': '123456' + } + + for k, v in examples.items(): + kcl.alter_topic_config({k: v}, incremental=False, topic=topic) + + # As a control, confirm that if we did pass an invalid property, we would have got an error + with expect_exception(RuntimeError, lambda e: "invalid" in str(e)): + kcl.alter_topic_config({"redpanda.invalid.property": 'true'}, + incremental=False, + topic=topic) + # When quickly recreating topics after deleting them, redpanda's topic # dir creation can trip up over the topic dir deletion. This is not