apovzner commented on a change in pull request #9628: URL: https://github.com/apache/kafka/pull/9628#discussion_r535830690
########## File path: core/src/test/scala/unit/kafka/admin/ConfigCommandTest.scala ########## @@ -472,6 +512,134 @@ class ConfigCommandTest extends ZooKeeperTestHarness with Logging { EasyMock.reset(alterResult, describeResult) } + @Test + def shouldNotAlterNonQuotaIpConfigsUsingBootstrapServer(): Unit = { + // when using --bootstrap-server, it should be illegal to alter anything that is not a connection quota + // for ip entities + val node = new Node(1, "localhost", 9092) + val mockAdminClient = new MockAdminClient(util.Collections.singletonList(node), node) + + def verifyCommand(entityType: String, alterOpts: String*): Unit = { + val opts = new ConfigCommandOptions(Array("--bootstrap-server", "localhost:9092", + "--entity-type", entityType, "--entity-name", "admin", + "--alter") ++ alterOpts) + val e = intercept[IllegalArgumentException] { + ConfigCommand.alterConfig(mockAdminClient, opts) + } + assertTrue(s"Unexpected exception: $e", e.getMessage.contains("some_config")) + } + + verifyCommand("ips", "--add-config", "connection_creation_rate=10000,some_config=10") Review comment: super tiny nit: `verifyCommand` name makes the code a bit confusing since the command is expected to fail. What about `verifyCommandFails` or `verifyFails`? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org