Skip to content

Commit

Permalink
[fix][test] Clear MockedPulsarServiceBaseTest fields to prevent test …
Browse files Browse the repository at this point in the history
…runtime memory leak (apache#22659)

(cherry picked from commit 025354e)
(cherry picked from commit 13f0aae)
  • Loading branch information
lhotari authored and srinath-ctds committed May 16, 2024
1 parent a62730f commit fc7e6d7
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,20 @@ protected final void internalCleanup() throws Exception {
}
if (brokerGateway != null) {
brokerGateway.close();
brokerGateway = null;
}
if (pulsarTestContext != null) {
pulsarTestContext.close();
pulsarTestContext = null;
}

resetConfig();
onCleanup();

// clear fields to avoid test runtime memory leak, pulsarTestContext already handles closing of these instances
pulsar = null;
mockZooKeeper = null;
mockZooKeeperGlobal = null;
}

protected void onCleanup() {
Expand Down

0 comments on commit fc7e6d7

Please sign in to comment.