sebastienviale commented on code in PR #17711:
URL: https://github.com/apache/kafka/pull/17711#discussion_r1843794423


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorStateManagerTest.java:
##########
@@ -771,6 +772,38 @@ public void close() {
         assertEquals(exception, thrown);
     }
 
+    @Test
+    public void 
shouldThrowProcessorStateExceptionOnFlushIfStoreThrowsAFailedProcessingException()
 {
+        final RuntimeException exception = new RuntimeException("KABOOM!");
+        final ProcessorStateManager stateManager = 
getStateManager(Task.TaskType.ACTIVE);
+        final MockKeyValueStore stateStore = new 
MockKeyValueStore(persistentStoreName, true) {
+            @Override
+            public void flush() {
+                throw new FailedProcessingException("processor", exception);
+            }
+        };
+        stateManager.registerStore(stateStore, 
stateStore.stateRestoreCallback, null);
+
+        final ProcessorStateException thrown = 
assertThrows(ProcessorStateException.class, stateManager::flush);
+        assertEquals(exception, thrown.getCause());

Review Comment:
   done



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorStateManagerTest.java:
##########
@@ -771,6 +772,38 @@ public void close() {
         assertEquals(exception, thrown);
     }
 
+    @Test
+    public void 
shouldThrowProcessorStateExceptionOnFlushIfStoreThrowsAFailedProcessingException()
 {
+        final RuntimeException exception = new RuntimeException("KABOOM!");
+        final ProcessorStateManager stateManager = 
getStateManager(Task.TaskType.ACTIVE);
+        final MockKeyValueStore stateStore = new 
MockKeyValueStore(persistentStoreName, true) {
+            @Override
+            public void flush() {
+                throw new FailedProcessingException("processor", exception);
+            }
+        };
+        stateManager.registerStore(stateStore, 
stateStore.stateRestoreCallback, null);
+
+        final ProcessorStateException thrown = 
assertThrows(ProcessorStateException.class, stateManager::flush);
+        assertEquals(exception, thrown.getCause());
+    }
+
+    @Test
+    public void 
shouldThrowProcessorStateExceptionOnCloseIfStoreThrowsAFailedProcessingException()
 {
+        final RuntimeException exception = new RuntimeException("KABOOM!");
+        final ProcessorStateManager stateManager = 
getStateManager(Task.TaskType.ACTIVE);
+        final MockKeyValueStore stateStore = new 
MockKeyValueStore(persistentStoreName, true) {
+            @Override
+            public void close() {
+                throw new FailedProcessingException("processor", exception);
+            }
+        };
+        stateManager.registerStore(stateStore, 
stateStore.stateRestoreCallback, null);
+
+        final ProcessorStateException thrown = 
assertThrows(ProcessorStateException.class, stateManager::close);
+        assertEquals(exception, thrown.getCause());

Review Comment:
   done



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to