diff --git a/src/v/kafka/server/handlers/configs/config_utils.h b/src/v/kafka/server/handlers/configs/config_utils.h index 1b28677b79655..714993703e4f1 100644 --- a/src/v/kafka/server/handlers/configs/config_utils.h +++ b/src/v/kafka/server/handlers/configs/config_utils.h @@ -34,6 +34,7 @@ #include +#include #include namespace kafka { @@ -627,10 +628,18 @@ inline void parse_and_set_bool( if (op == config_resource_operation::set && value) { try { - property.value = string_switch(*value) + // Ignore case. + auto str_value = std::move(*value); + std::transform( + str_value.begin(), + str_value.end(), + str_value.begin(), + [](const auto& c) { return std::tolower(c); }); + + property.value = string_switch(str_value) .match("true", true) .match("false", false); - auto v_error = validator(tn, *value, property.value); + auto v_error = validator(tn, str_value, property.value); if (v_error) { throw validation_error{*v_error}; } diff --git a/src/v/kafka/server/tests/alter_config_test.cc b/src/v/kafka/server/tests/alter_config_test.cc index d17fb97024070..ab955a930408e 100644 --- a/src/v/kafka/server/tests/alter_config_test.cc +++ b/src/v/kafka/server/tests/alter_config_test.cc @@ -1053,3 +1053,33 @@ FIXTURE_TEST( describe_resp); } } + +FIXTURE_TEST( + test_shadow_indexing_uppercase_alter_config, alter_config_test_fixture) { + wait_for_controller_leadership().get(); + model::topic test_tp{"topic-1"}; + create_topic(test_tp, 6); + using map_t = absl::flat_hash_map< + ss::sstring, + std::pair, kafka::config_resource_operation>>; + map_t properties; + // Case is on purpose. + properties.emplace( + "redpanda.remote.write", + std::make_pair("True", kafka::config_resource_operation::set)); + properties.emplace( + "redpanda.remote.read", + std::make_pair("TRUE", kafka::config_resource_operation::set)); + + auto resp = incremental_alter_configs( + make_incremental_alter_topic_config_resource_cv(test_tp, properties)); + + BOOST_REQUIRE_EQUAL(resp.data.responses.size(), 1); + BOOST_REQUIRE_EQUAL( + resp.data.responses[0].error_code, kafka::error_code::none); + auto describe_resp = describe_configs(test_tp); + assert_property_value( + test_tp, "redpanda.remote.write", "true", describe_resp); + assert_property_value( + test_tp, "redpanda.remote.read", "true", describe_resp); +}