clolov commented on code in PR #14716:
URL: https://github.com/apache/kafka/pull/14716#discussion_r1557539618


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamTaskTest.java:
##########
@@ -293,17 +288,12 @@ public void cleanup() throws IOException {
             task = null;
         }
         Utils.delete(BASE_DIR);
-        mockito.finishMocking();
     }
 
     @Test
-    public void shouldThrowLockExceptionIfFailedToLockStateDirectory() throws 
IOException {
-        stateDirectory = EasyMock.createNiceMock(StateDirectory.class);
-        EasyMock.expect(stateDirectory.lock(taskId)).andReturn(false);
-        
EasyMock.expect(stateManager.changelogPartitions()).andReturn(Collections.emptySet());
-        stateManager.registerStore(stateStore, 
stateStore.stateRestoreCallback, null);
-        EasyMock.expectLastCall();
-        EasyMock.replay(stateDirectory, stateManager);
+    public void shouldThrowLockExceptionIfFailedToLockStateDirectory() {
+        stateDirectory = mock(StateDirectory.class);

Review Comment:
   So, I tried with explicitly closing the "old" stateDirectory, but that was 
complaining because the lockStateDirectory method was never called on it:
   ```
       @Override
       public void close() {
           if (hasPersistentStores) {
               try {
                   stateDirLock.release(); <--- THIS IS NULL;
                   stateDirLockChannel.close();
   
                   stateDirLock = null;
                   stateDirLockChannel = null;
               } catch (final IOException e) {
                  ...
               }
           }
       }
   ```
   I am not too familiar with the StateDirectory class itself, what underlying 
resources could be leaking and I ought to pay attention to closing?



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