Skip to content

Commit

Permalink
Merge pull request #5750 from tchaikov/tests/alter_config_test
Browse files Browse the repository at this point in the history
config: correct value of expected retention
  • Loading branch information
dotnwat committed Aug 16, 2022
2 parents cee0ab6 + 8de1501 commit a17df80
Showing 1 changed file with 17 additions and 11 deletions.
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

0 comments on commit a17df80

Please sign in to comment.