jolshan commented on a change in pull request #9814: URL: https://github.com/apache/kafka/pull/9814#discussion_r555957351
########## File path: core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala ########## @@ -884,6 +884,37 @@ class ControllerIntegrationTest extends ZooKeeperTestHarness { assertNotEquals(topicId1, topicId2) } + @Test + def testTopicIdsAreNotAdded(): Unit = { + servers = makeServers(1, interBrokerProtocolVersion = Some(KAFKA_2_7_IV0)) + TestUtils.waitUntilControllerElected(zkClient) + val controller = getController().kafkaController + val tp1 = new TopicPartition("t1", 0) + val assignment1 = Map(tp1.partition -> Seq(0)) + + // Before adding the topic, an attempt to get the ID should result in None. + assertEquals(None, controller.controllerContext.topicIds.get("t1")) + + TestUtils.createTopic(zkClient, tp1.topic(), assignment1, servers) + + // Test that the first topic has its ID added correctly Review comment: Good catch. ---------------------------------------------------------------- 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