mwesterby commented on code in PR #23639:
URL: https://github.com/apache/kafka/pull/23639#discussion_r4493081092


##########
metadata/src/test/java/org/apache/kafka/controller/QuorumControllerTest.java:
##########
@@ -1789,4 +1788,51 @@ public void 
testBrokerHeartbeatDuringMigration(MetadataVersion metadataVersion)
 
         }
     }
+
+    @Test
+    public void testForceRenounceResignsActiveController() throws Throwable {
+        try (
+                LocalLogManagerTestEnv logEnv = new 
LocalLogManagerTestEnv.Builder(3).
+                        build();
+                QuorumControllerTestEnv controlEnv = new 
QuorumControllerTestEnv.Builder(logEnv).
+                        build()
+        ) {
+            QuorumController active = controlEnv.activeController(true);
+            int previousEpoch = active.curClaimEpoch();
+
+            active.forceRenounce().get(20, TimeUnit.SECONDS);
+
+            assertEquals(-1, active.curClaimEpoch());

Review Comment:
   Good spot. And you're right, the `newActive.curClaimEpoch() > previousEpoch` 
can only be true if the old term ended and a new election happened. That 
already proves the renounce.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to