You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Rancho-7 (via GitHub)" <gi...@apache.org> on 2024/11/12 08:27:47 UTC
[PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Rancho-7 opened a new pull request, #17771:
URL: https://github.com/apache/kafka/pull/17771
add Integration test for ConfigCommand to add config `key=[val1,val2]`
JIRA:https://issues.apache.org/jira/browse/KAFKA-17981
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [x] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Yunyung (via GitHub)" <gi...@apache.org>.
Yunyung commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1837993667
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,41 @@ public void testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.", message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+ String topicName = "test-topic";
+
+ try (Admin client = cluster.createAdminClient()) {
+ NewTopic newTopic = new NewTopic(topicName, 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ }
+
+ String configKey = "cleanup.policy";
+ List<String> configValues = List.of("delete", "compact");
+ String configValueStr = String.join(",", configValues);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", topicName,
Review Comment:
To follow the coding style in this file, like in `testNullStatusOnKraftCommandAlterClientMetrics`, it’s better to explicitly list constant strings instead of storing them in variables.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Yunyung (via GitHub)" <gi...@apache.org>.
Yunyung commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1837995366
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,41 @@ public void testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.", message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+ String topicName = "test-topic";
+
+ try (Admin client = cluster.createAdminClient()) {
+ NewTopic newTopic = new NewTopic(topicName, 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ }
+
+ String configKey = "cleanup.policy";
+ List<String> configValues = List.of("delete", "compact");
+ String configValueStr = String.join(",", configValues);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", topicName,
+ "--alter", "--add-config", configKey + "=" + "[" + configValueStr + "]"));
+
+ String output = captureStandardStream(false, run(command));
Review Comment:
Change naming output -> message.
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,41 @@ public void testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.", message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+ String topicName = "test-topic";
+
+ try (Admin client = cluster.createAdminClient()) {
+ NewTopic newTopic = new NewTopic(topicName, 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ }
+
+ String configKey = "cleanup.policy";
+ List<String> configValues = List.of("delete", "compact");
+ String configValueStr = String.join(",", configValues);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", topicName,
+ "--alter", "--add-config", configKey + "=" + "[" + configValueStr + "]"));
Review Comment:
ditto
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1838047790
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,41 @@ public void testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.", message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+ String topicName = "test-topic";
+
+ try (Admin client = cluster.createAdminClient()) {
+ NewTopic newTopic = new NewTopic(topicName, 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ }
+
+ String configKey = "cleanup.policy";
+ List<String> configValues = List.of("delete", "compact");
+ String configValueStr = String.join(",", configValues);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", topicName,
Review Comment:
ok.done.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1848693145
##########
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:
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17771:
URL: https://github.com/apache/kafka/pull/17771#issuecomment-2670383859
This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.
<p>
If you are having difficulty finding a reviewer, please reach out on the
[mailing list](https://kafka.apache.org/contact).
<p>
If this PR is no longer valid or desired, please feel free to close it. If no activity
occurs in the next 30 days, it will be automatically closed.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1849500672
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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);
Review Comment:
Okay.
> Nit: `String topic = "test-topic";` and replace all "test-topic" with `topic`.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1848500117
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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();
+ }
+
Review Comment:
We need to make sure topic is created here.
You can use https://github.com/apache/kafka/blob/53d8316b5da7d8355331aa2d50193748c8261706/test-common/test-common-api/src/main/java/org/apache/kafka/common/test/api/ClusterInstance.java#L250
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1838048135
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,41 @@ public void testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.", message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+ String topicName = "test-topic";
+
+ try (Admin client = cluster.createAdminClient()) {
+ NewTopic newTopic = new NewTopic(topicName, 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ }
+
+ String configKey = "cleanup.policy";
+ List<String> configValues = List.of("delete", "compact");
+ String configValueStr = String.join(",", configValues);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", topicName,
+ "--alter", "--add-config", configKey + "=" + "[" + configValueStr + "]"));
Review Comment:
done.
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,41 @@ public void testNullStatusOnKraftCommandAlterClientMetrics() {
assertEquals("Completed updating config for client-metric cm.", message);
}
+ @ClusterTest
+ public void testAddConfigKeyValuesUsingCommand() throws Exception {
+ String topicName = "test-topic";
+
+ try (Admin client = cluster.createAdminClient()) {
+ NewTopic newTopic = new NewTopic(topicName, 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ }
+
+ String configKey = "cleanup.policy";
+ List<String> configValues = List.of("delete", "compact");
+ String configValueStr = String.join(",", configValues);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", topicName,
+ "--alter", "--add-config", configKey + "=" + "[" + configValueStr + "]"));
+
+ String output = captureStandardStream(false, run(command));
Review Comment:
done.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1849499551
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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");
+
+ //Clean up by deleting topic
+ client.deleteTopics(Collections.singleton("test-topic")).all().get();
Review Comment:
Yes,you are right. Thanks!
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1850237251
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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");
+
+ //Clean up by deleting topic
+ client.deleteTopics(Collections.singleton("test-topic")).all().get();
Review Comment:
> We also need to make sure topic already deleted here. `cluster.waitForTopic("test-topic, 0);`
Hi,I find that the topic will be deleted automatically,so may be there is no need to do that manually?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on PR #17771:
URL: https://github.com/apache/kafka/pull/17771#issuecomment-2486214661
Thanks for the patch. I leave some comments.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1850344139
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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");
+
+ //Clean up by deleting topic
+ client.deleteTopics(Collections.singleton("test-topic")).all().get();
Review Comment:
You are right. `clusterInstance` will delete dir automatically.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #17771:
URL: https://github.com/apache/kafka/pull/17771
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Yunyung (via GitHub)" <gi...@apache.org>.
Yunyung commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1850350465
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,34 @@ 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("topic", 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ cluster.waitForTopic("topic", 1);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "topic",
+ "--alter", "--add-config", "cleanup.policy=[delete,compact]"));
+
+ String message = captureStandardStream(false, run(command));
+ assertEquals("Completed updating config for topic topic.", message);
+
+ command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "topic",
+ "--describe"));
+
+ message = captureStandardStream(false, run(command));
+ assertTrue(message.contains("cleanup.policy=delete,compact"), "Config entry was not added correctly");
+
+ }
+
Review Comment:
ditto
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1849404649
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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);
Review Comment:
Nit: `String topic = "test-topic";` and replace all "test-topic" with `topic`.
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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");
+
+ //Clean up by deleting topic
+ client.deleteTopics(Collections.singleton("test-topic")).all().get();
Review Comment:
We also need to make sure topic already deleted here.
`cluster.waitForTopic("test-topic, 0);`
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1850347152
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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);
Review Comment:
My meaning is using variable to replace constant but this PR is good enough.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1850355256
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,34 @@ 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("topic", 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ cluster.waitForTopic("topic", 1);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "topic",
+ "--alter", "--add-config", "cleanup.policy=[delete,compact]"));
+
+ String message = captureStandardStream(false, run(command));
+ assertEquals("Completed updating config for topic topic.", message);
+
+ command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "topic",
+ "--describe"));
+
+ message = captureStandardStream(false, run(command));
+ assertTrue(message.contains("cleanup.policy=delete,compact"), "Config entry was not added correctly");
+
Review Comment:
> nit: delete extra line.
ok
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on PR #17771:
URL: https://github.com/apache/kafka/pull/17771#issuecomment-2490245148
@chia7712 PTAL.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Rancho-7 (via GitHub)" <gi...@apache.org>.
Rancho-7 commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1848522628
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,36 @@ 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();
+ }
+
Review Comment:
OK.Thanks.I will fix it.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Yunyung (via GitHub)" <gi...@apache.org>.
Yunyung commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1850348815
##########
core/src/test/java/kafka/admin/ConfigCommandIntegrationTest.java:
##########
@@ -138,6 +139,34 @@ 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("topic", 1, (short) 1);
+ client.createTopics(Collections.singleton(newTopic)).all().get();
+ cluster.waitForTopic("topic", 1);
+
+ Stream<String> command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "topic",
+ "--alter", "--add-config", "cleanup.policy=[delete,compact]"));
+
+ String message = captureStandardStream(false, run(command));
+ assertEquals("Completed updating config for topic topic.", message);
+
+ command = Stream.concat(quorumArgs(), Stream.of(
+ "--entity-type", "topics",
+ "--entity-name", "topic",
+ "--describe"));
+
+ message = captureStandardStream(false, run(command));
+ assertTrue(message.contains("cleanup.policy=delete,compact"), "Config entry was not added correctly");
+
Review Comment:
nit: delete extra line.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "TaiJuWu (via GitHub)" <gi...@apache.org>.
TaiJuWu commented on code in PR #17771:
URL: https://github.com/apache/kafka/pull/17771#discussion_r1848693145
##########
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:
ditto.
Additionally, we can reuse the same `admin` to avoid create 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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-17981:add Integration test for ConfigCommand to add config `key=[val1,val2]` [kafka]
Posted by "Yunyung (via GitHub)" <gi...@apache.org>.
Yunyung commented on PR #17771:
URL: https://github.com/apache/kafka/pull/17771#issuecomment-2488660050
LGTM.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org