platinumhamburg commented on code in PR #1470:
URL: https://github.com/apache/fluss/pull/1470#discussion_r2309023405


##########
fluss-server/src/test/java/com/alibaba/fluss/server/coordinator/CompletedSnapshotStoreManagerTest.java:
##########
@@ -172,6 +181,50 @@ void testRemoveCompletedSnapshotStoreFromManager() throws 
Exception {
         
assertThat(completedSnapshotStoreManager.getBucketCompletedSnapshotStores()).isEmpty();
     }
 
+    @Test
+    void testMetadataInconsistencyWithMetadataNotExistsException() throws 
Exception {
+        // setup test data with mixed valid and invalid snapshots
+        TableBucket tableBucket = new TableBucket(1, 1);
+        CompletedSnapshot validSnapshot =
+                KvTestUtils.mockCompletedSnapshot(tempDir, tableBucket, 1L);
+        CompletedSnapshotHandle validSnapshotHandle = 
mock(CompletedSnapshotHandle.class);
+        
when(validSnapshotHandle.getSnapshotId()).thenReturn(validSnapshot.getSnapshotID());
+        when(validSnapshotHandle.getMetadataFilePath())
+                .thenReturn(validSnapshot.getMetadataFilePath());
+        
when(validSnapshotHandle.retrieveCompleteSnapshot()).thenReturn(validSnapshot);
+
+        CompletedSnapshot invalidSnapshot =
+                KvTestUtils.mockCompletedSnapshot(tempDir, tableBucket, 2L);
+        CompletedSnapshotHandle invalidSnapshotHandle = 
mock(CompletedSnapshotHandle.class);
+        
when(invalidSnapshotHandle.getSnapshotId()).thenReturn(invalidSnapshot.getSnapshotID());
+        when(invalidSnapshotHandle.getMetadataFilePath())
+                .thenReturn(invalidSnapshot.getMetadataFilePath());

Review Comment:
   Thanks for the suggestion. I've refactored this case to avoid using Mockito.



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