Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: correct value of expected retention #5750

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/v/kafka/server/tests/alter_config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ FIXTURE_TEST(test_alter_single_topic_config, alter_config_test_fixture) {
BOOST_REQUIRE_EQUAL(resp.data.responses[0].resource_name, test_tp);

auto describe_resp = describe_configs(test_tp);
assert_property_value(test_tp, "retention.ms", "1234", describe_resp);
assert_property_value(
test_tp, "retention.ms", fmt::format("{}", 1234ms), describe_resp);
assert_property_value(test_tp, "cleanup.policy", "compact", describe_resp);
assert_property_value(
test_tp, "redpanda.remote.read", "true", describe_resp);
Expand Down Expand Up @@ -475,7 +476,8 @@ FIXTURE_TEST(test_alter_multiple_topics_config, alter_config_test_fixture) {
BOOST_REQUIRE_EQUAL(resp.data.responses[1].resource_name, topic_2);

auto describe_resp_1 = describe_configs(topic_1);
assert_property_value(topic_1, "retention.ms", "1234", describe_resp_1);
assert_property_value(
topic_1, "retention.ms", fmt::format("{}", 1234ms), describe_resp_1);
assert_property_value(
topic_1, "cleanup.policy", "compact", describe_resp_1);

Expand Down Expand Up @@ -536,7 +538,8 @@ FIXTURE_TEST(
BOOST_REQUIRE_EQUAL(resp.data.responses[0].resource_name, test_tp);

auto describe_resp = describe_configs(test_tp);
assert_property_value(test_tp, "retention.ms", "1234", describe_resp);
assert_property_value(
test_tp, "retention.ms", fmt::format("{}", 1234ms), describe_resp);

/**
* Set custom retention.bytes, previous settings should be overriden
Expand All @@ -552,8 +555,7 @@ FIXTURE_TEST(
test_tp,
"retention.ms",
fmt::format(
"{}",
config::shard_local_cfg().delete_retention_ms().value_or(-1ms).count()),
"{}", config::shard_local_cfg().delete_retention_ms().value_or(-1ms)),
new_describe_resp);
assert_property_value(
test_tp, "retention.bytes", "4096", new_describe_resp);
Expand Down Expand Up @@ -581,7 +583,8 @@ FIXTURE_TEST(test_incremental_alter_config, alter_config_test_fixture) {
BOOST_REQUIRE_EQUAL(resp.data.responses[0].resource_name, test_tp);

auto describe_resp = describe_configs(test_tp);
assert_property_value(test_tp, "retention.ms", "1234", describe_resp);
assert_property_value(
test_tp, "retention.ms", fmt::format("{}", 1234ms), describe_resp);

/**
* Set custom retention.bytes, only this property should be updated
Expand All @@ -600,7 +603,7 @@ FIXTURE_TEST(test_incremental_alter_config, alter_config_test_fixture) {
auto new_describe_resp = describe_configs(test_tp);
// retention.ms should stay untouched
assert_property_value(
test_tp, "retention.ms", fmt::format("1234"), new_describe_resp);
test_tp, "retention.ms", fmt::format("{}", 1234ms), new_describe_resp);
assert_property_value(
test_tp, "retention.bytes", "4096", new_describe_resp);
}
Expand Down Expand Up @@ -649,7 +652,8 @@ FIXTURE_TEST(test_incremental_alter_config_remove, alter_config_test_fixture) {
BOOST_REQUIRE_EQUAL(resp.data.responses[0].resource_name, test_tp);

auto describe_resp = describe_configs(test_tp);
assert_property_value(test_tp, "retention.ms", "1234", describe_resp);
assert_property_value(
test_tp, "retention.ms", fmt::format("{}", 1234ms), describe_resp);

/**
* Remove retention.bytes
Expand All @@ -671,8 +675,7 @@ FIXTURE_TEST(test_incremental_alter_config_remove, alter_config_test_fixture) {
test_tp,
"retention.ms",
fmt::format(
"{}",
config::shard_local_cfg().delete_retention_ms().value_or(-1ms).count()),
"{}", config::shard_local_cfg().delete_retention_ms().value_or(-1ms)),
new_describe_resp);
}

Expand Down Expand Up @@ -766,7 +769,10 @@ FIXTURE_TEST(

auto alter_config_describe_resp = describe_configs(test_tp);
assert_property_value(
test_tp, "retention.ms", "1234", alter_config_describe_resp);
test_tp,
"retention.ms",
fmt::format("{}", 1234ms),
alter_config_describe_resp);

std::ostringstream stream2;
stream2 << dp1;
Expand Down