XComp commented on a change in pull request #18869:
URL: https://github.com/apache/flink/pull/18869#discussion_r813939700
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStoreTest.java
##########
@@ -137,6 +161,141 @@ public void testAddAndLock() throws Exception {
assertEquals(state, actual);
}
+ @Test
+ public void testAddAndLockOnMarkedForDeletionNode() throws Exception {
+ final CuratorFramework client =
+ ZooKeeperUtils.useNamespaceAndEnsurePath(
+ ZOOKEEPER.getClient(),
"/testAddAndLockOnMarkedForDeletionNode");
+ final
ZooKeeperStateHandleStore<TestingLongStateHandleHelper.LongStateHandle> zkStore
=
+ new ZooKeeperStateHandleStore<>(client, new
TestingLongStateHandleHelper());
+
+ final String markedForDeletionNode = "marked-for-deletion";
+ final long oldStateValue = 1L;
+ zkStore.addAndLock(
+ generateZookeeperPath(markedForDeletionNode),
+ new
TestingLongStateHandleHelper.LongStateHandle(oldStateValue));
+
+ markNodeForDeletion(client, markedForDeletionNode);
+
+ // Test
+ final long updatedStateValue = oldStateValue + 2;
+ zkStore.addAndLock(
+ generateZookeeperPath(markedForDeletionNode),
+ new
TestingLongStateHandleHelper.LongStateHandle(updatedStateValue));
+
+ // Verify
+ // State handle created
+ assertEquals(1, zkStore.getAllAndLock().size());
+ assertEquals(
+ updatedStateValue,
+
zkStore.getAndLock(generateZookeeperPath(markedForDeletionNode))
+ .retrieveState()
+ .getValue());
+ }
+
+ @Test
+ public void testRepeatableCleanup() throws Exception {
+ final
ZooKeeperStateHandleStore<TestingLongStateHandleHelper.LongStateHandle>
testInstance =
+ new ZooKeeperStateHandleStore<>(
+ ZOOKEEPER.getClient(), new
TestingLongStateHandleHelper());
+
+ final String pathInZooKeeper = "/testRepeatableCleanup";
+
+ final RuntimeException expectedException =
+ new RuntimeException("Expected RuntimeException");
+ final TestingLongStateHandleHelper.LongStateHandle stateHandle =
+ new TestingLongStateHandleHelper.LongStateHandle(12354L,
expectedException);
+
+ testInstance.addAndLock(pathInZooKeeper, stateHandle);
+
+ try {
+ testInstance.releaseAndTryRemove(pathInZooKeeper);
Review comment:
That's not possible here, is it? Because we need to verify the cause
tree. But the one underneath should work... 👍
--
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]