rondagostino commented on code in PR #13116: URL: https://github.com/apache/kafka/pull/13116#discussion_r1128069250
########## core/src/test/scala/unit/kafka/server/DynamicBrokerConfigTest.scala: ########## @@ -479,6 +489,42 @@ class DynamicBrokerConfigTest { assertEquals("User:admin", authorizer.superUsers) } + @Test + def testCombinedControllerAuthorizerConfig(): Unit = { + val props = TestUtils.createCombinedControllerConfig(0, port = 9092) + val oldConfig = KafkaConfig.fromProps(props) + oldConfig.dynamicConfig.initialize(None) + + val controllerServer: ControllerServer = mock(classOf[kafka.server.ControllerServer]) + + val authorizer = new TestAuthorizer + when(controllerServer.config).thenReturn(oldConfig) + when(controllerServer.authorizer).thenReturn(Some(authorizer)) + // We are only testing authorizer reconfiguration, ignore any exceptions due to incomplete mock + assertThrows(classOf[Throwable], () => controllerServer.config.dynamicConfig.addReconfigurables(controllerServer)) Review Comment: I fixed it. ########## core/src/test/scala/unit/kafka/server/DynamicBrokerConfigTest.scala: ########## @@ -479,6 +489,42 @@ class DynamicBrokerConfigTest { assertEquals("User:admin", authorizer.superUsers) } + @Test + def testCombinedControllerAuthorizerConfig(): Unit = { + val props = TestUtils.createCombinedControllerConfig(0, port = 9092) + val oldConfig = KafkaConfig.fromProps(props) + oldConfig.dynamicConfig.initialize(None) + + val controllerServer: ControllerServer = mock(classOf[kafka.server.ControllerServer]) + + val authorizer = new TestAuthorizer + when(controllerServer.config).thenReturn(oldConfig) + when(controllerServer.authorizer).thenReturn(Some(authorizer)) + // We are only testing authorizer reconfiguration, ignore any exceptions due to incomplete mock + assertThrows(classOf[Throwable], () => controllerServer.config.dynamicConfig.addReconfigurables(controllerServer)) + props.put("super.users", "User:admin") + controllerServer.config.dynamicConfig.updateBrokerConfig(0, props) + assertEquals("User:admin", authorizer.superUsers) + } + + @Test + def testIsolatedControllerAuthorizerConfig(): Unit = { + val props = TestUtils.createIsolatedControllerConfig(0, port = 9092) + val oldConfig = KafkaConfig.fromProps(props) + oldConfig.dynamicConfig.initialize(None) + + val controllerServer: ControllerServer = mock(classOf[kafka.server.ControllerServer]) + + val authorizer = new TestAuthorizer + when(controllerServer.config).thenReturn(oldConfig) + when(controllerServer.authorizer).thenReturn(Some(authorizer)) + // We are only testing authorizer reconfiguration, ignore any exceptions due to incomplete mock + assertThrows(classOf[Throwable], () => controllerServer.config.dynamicConfig.addReconfigurables(controllerServer)) Review Comment: Same here -- I fixed 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org