cmccabe commented on code in PR #14807: URL: https://github.com/apache/kafka/pull/14807#discussion_r1401042371
########## metadata/src/test/java/org/apache/kafka/image/ClusterImageTest.java: ########## @@ -205,4 +207,22 @@ private static List<ApiMessageAndVersion> getImageRecords(ClusterImage image) { image.write(writer, new ImageWriterOptions.Builder().build()); return writer.records(); } + + @Test + public void testHandleLossOfControllerRegistrations() { + ClusterImage testImage = new ClusterImage(Collections.emptyMap(), + Collections.singletonMap(1000, new ControllerRegistration.Builder(). + setId(1000). + setIncarnationId(Uuid.fromString("9ABu6HEgRuS-hjHLgC4cHw")). + setListeners(Collections.singletonMap("PLAINTEXT", + new Endpoint("PLAINTEXT", SecurityProtocol.PLAINTEXT, "localhost", 19092))). + setSupportedFeatures(Collections.emptyMap()).build())); + RecordListWriter writer = new RecordListWriter(); + final AtomicReference<String> lossString = new AtomicReference<>(""); + testImage.write(writer, new ImageWriterOptions.Builder(). + setMetadataVersion(MetadataVersion.IBP_3_6_IV2). + setLossHandler(loss -> lossString.compareAndSet("controller registration data", loss.loss())). + build()); + assertEquals("", lossString.get()); Review Comment: Sorry, I forgot to push the latest version. Should be fixed now. -- 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