XComp commented on a change in pull request #19191:
URL: https://github.com/apache/flink/pull/19191#discussion_r831167459



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/ZooKeeperCheckpointIDCounterITCase.java
##########
@@ -66,6 +70,56 @@ public void testShutdownRemovesState() throws Exception {
         assertThat(client.checkExists().forPath(counter.getPath())).isNull();
     }
 
+    @Test
+    public void testShutdownForLocallyTerminatedJobStatus() throws Exception {
+        ZooKeeperCheckpointIDCounter counter = createCheckpointIdCounter();
+        counter.start();
+
+        CuratorFramework client = zookeeper.getClient();
+        
assertThat(client.checkExists().forPath(counter.getPath())).isNotNull();
+
+        counter.shutdown(JobStatus.SUSPENDED).join();
+        
assertThat(client.checkExists().forPath(counter.getPath())).isNotNull();
+    }
+
+    @Test
+    public void testIdempotentShutdown() throws Exception {
+        ZooKeeperCheckpointIDCounter counter = createCheckpointIdCounter();
+        counter.start();
+
+        CuratorFramework client = zookeeper.getClient();
+        client.delete().forPath(counter.getPath());
+
+        // shutdown shouldn't fail due to missing path
+        counter.shutdown(JobStatus.FINISHED).join();
+        assertThat(client.checkExists().forPath(counter.getPath())).isNull();
+    }
+
+    @Test
+    public void testShutdownWithFailureDueToMissingConnection() throws 
Exception {
+        ZooKeeperCheckpointIDCounter counter = createCheckpointIdCounter();
+        counter.start();
+
+        cleanAndStopZooKeeperIfRunning();
+
+        
assertThat(counter.shutdown(JobStatus.FINISHED)).failsWithin(Duration.ofHours(1));
+    }
+
+    @Test
+    public void testShutdownWithFailureDueToChildNodes() throws Exception {

Review comment:
       No, the deletion is failing because there are child nodes which I added 
for the test case (and I removed the recursive deletion). The IDCounter 
shouldn't have child nodes in general...




-- 
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