tinaselenge commented on code in PR #13102: URL: https://github.com/apache/kafka/pull/13102#discussion_r1067964100
########## raft/src/test/java/org/apache/kafka/raft/FileBasedStateStoreTest.java: ########## @@ -90,6 +98,43 @@ public void testWriteElectionState() throws IOException { assertFalse(stateFile.exists()); } + @Test + public void testCompatibilityWithClusterId() throws IOException { + final File stateFile = TestUtils.tempFile(); + stateStore = new FileBasedStateStore(stateFile); + + // We initialized a state from the metadata log + assertTrue(stateFile.exists()); + + String jsonString = "{\"clusterId\":\"abc\",\"leaderId\":0,\"leaderEpoch\":0,\"votedId\":-1,\"appliedOffset\":0,\"currentVoters\":[],\"data_version\":0}"; + writeToStateFile(stateFile, jsonString); + + // verify that we can read the state file that contains the removed "cluserId" field. + assertEquals(stateStore.readElectionState(), new ElectionState(0, + OptionalInt.of(0), OptionalInt.empty(), Collections.emptySet())); Review Comment: Thanks Luke for pointing them out. Fixed the test 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