You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/12/19 20:03:14 UTC

[GitHub] [kafka] lucasbru commented on a diff in pull request #12959: MINOR: Fix various memory leaks in tests

lucasbru commented on code in PR #12959:
URL: https://github.com/apache/kafka/pull/12959#discussion_r1052575316


##########
streams/src/test/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionStoreReceiveProcessorSupplierTest.java:
##########
@@ -130,6 +134,8 @@ public void shouldDeleteKeyAndPropagateV0() {
                   .withValue(new Change<>(newValue, oldValue)),
             forwarded.get(0).record()
         );
+
+        stateStore.close();

Review Comment:
   yeah, that's a duplicate



##########
streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java:
##########
@@ -253,6 +258,11 @@ private void verifyColumnFamilyOptionsMethodCall(final Method method) throws Exc
             assertThat(undeclaredMockMethodCall.getCause(), instanceOf(AssertionError.class));
             assertThat(undeclaredMockMethodCall.getCause().getMessage().trim(),
                 matchesPattern("Unexpected method call ColumnFamilyOptions\\." + method.getName() +  "(.*)"));
+        } finally {
+            reset(mockedColumnFamilyOptions);

Review Comment:
   Done



##########
streams/src/test/java/org/apache/kafka/streams/state/internals/RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java:
##########
@@ -148,6 +148,11 @@ private void verifyDBOptionsMethodCall(final Method method) throws Exception {
             assertThat(undeclaredMockMethodCall.getCause(), instanceOf(AssertionError.class));
             assertThat(undeclaredMockMethodCall.getCause().getMessage().trim(),
                 matchesPattern("Unexpected method call DBOptions\\." + method.getName() + "((.*\n*)*):"));
+        } finally {
+            reset(mockedDbOptions);
+            mockedDbOptions.close();
+            replay(mockedDbOptions);
+            optionsFacadeDbOptions.close();

Review Comment:
   I'm just doing this so that easymock doesn't complain about `close` being called on the unterlying mock. I want to call close here to free up resources, and the best way here is to tell easymock what to expect on the mocks.
   
   I found an alternative way to do this via `resetToNice` which should be less confusing.



-- 
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-unsubscribe@kafka.apache.org

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