From bac883a53bce3b16d46201529d54e5476b7b8630 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Wed, 25 May 2022 17:19:34 +0100 Subject: [PATCH] tests: test topic creation with invalid configs Add tests for topic creation requests that use unexpected literal values (e.g. `compression.type=foo`). --- tests/rptest/tests/rpk_topic_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/rptest/tests/rpk_topic_test.py b/tests/rptest/tests/rpk_topic_test.py index 336e20210b8e..ecfcbcb5fbfa 100644 --- a/tests/rptest/tests/rpk_topic_test.py +++ b/tests/rptest/tests/rpk_topic_test.py @@ -7,13 +7,15 @@ # the Business Source License, use of this software will be governed # by the Apache License, Version 2.0 +from ducktape.mark import parametrize from ducktape.utils.util import wait_until from rptest.services.cluster import cluster import ducktape.errors from rptest.tests.redpanda_test import RedpandaTest -from rptest.clients.rpk import RpkTool +from rptest.clients.rpk import RpkTool, RpkException from rptest.services.rpk_consumer import RpkConsumer +from rptest.util import expect_exception import time import random @@ -34,6 +36,16 @@ def test_create_topic(self): backoff_sec=1, err_msg="Topic never appeared.") + @cluster(num_nodes=1) + @parametrize(config_type="compression.type") + @parametrize(config_type="compaction.strategy") + @parametrize(config_type="message.timestamp.type") + @parametrize(config_type="cleanup.policy") + def test_create_topic_with_invalid_config(self, config_type): + with expect_exception(RpkException, + lambda e: "INVALID_CONFIG" in str(e)): + out = self._rpk.create_topic("topic", config={config_type: "foo"}) + @cluster(num_nodes=4) def test_produce(self): topic = 'topic'