tillrohrmann commented on a change in pull request #13644:
URL: https://github.com/apache/flink/pull/13644#discussion_r516786488



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionTest.java
##########
@@ -520,6 +519,47 @@ public void testEphemeralZooKeeperNodes() throws Exception 
{
                }
        }
 
+       @Test
+       public void testNotLeader() throws Exception {
+
+               final TestingLeaderElectionEventHandler electionEventHandler =
+                       new TestingLeaderElectionEventHandler(TEST_LEADER);
+               final TestingLeaderRetrievalEventHandler retrievalEventHandler 
= new TestingLeaderRetrievalEventHandler();
+               LeaderElectionDriver leaderElectionDriver = null;
+               LeaderRetrievalDriver leaderRetrievalDriver = null;
+               try {
+
+                       leaderElectionDriver =
+                               
ZooKeeperUtils.createLeaderElectionDriverFactory(client, configuration)
+                                       
.createLeaderElectionDriver(electionEventHandler, 
electionEventHandler::handleError, TEST_URL);
+                       electionEventHandler.init(leaderElectionDriver);
+
+                       electionEventHandler.waitForLeader(timeout);
+                       
assertThat(electionEventHandler.getConfirmedLeaderInformation(), 
is(TEST_LEADER));
+
+                       // Leader is revoked
+                       ((ZooKeeperLeaderElectionDriver) 
leaderElectionDriver).notLeader();
+                       electionEventHandler.waitForRevokeLeader(timeout);
+                       
assertThat(electionEventHandler.getConfirmedLeaderInformation(), 
is(LeaderInformation.empty()));
+                       // The data on ZooKeeper it not be cleared

Review comment:
       Sounds good.




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


Reply via email to