Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1849375257
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,37 @@ public void
testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.",
message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+
+ try (Admin client = cluster.admin()) {
+ NewTopic newTopic = new NewTopic("test-topic", 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ cluster.waitForTopic("test-topic", 1);
+ }
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "test-topic",
+ "--alter", "--add-config", "cleanup.policy=[delete,compact]"));
+
+ String message = captureStandardStream(false, run(command));
+ assertEquals("Completed updating config for topic test-topic.",
message);
+
+ command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "test-topic",
+ "--describe"));
+
+ message = captureStandardStream(false, run(command));
+ assertTrue(message.contains("cleanup.policy=delete,compact"), "Config
entry was not added correctly");
+
+ try (Admin client = cluster.admin()) {
+
client.deleteTopics(Collections.singleton("test-topic")).all().get();
Review Comment:
Seems good.I will adjust my code.Thanks!
> ditto. Additionally, we can reuse the same `admin` to avoid creating admin
two times.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]