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)
  • Loading branch information
lhotari committed May 14, 2024
1 parent 91f4287 commit 13f0aae
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,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 13f0aae

Please sign in to comment.