Skip to content

Commit

Permalink
[fix][test] Fix some resource leaks in compaction tests (apache#21374)
Browse files Browse the repository at this point in the history
(cherry picked from commit e6cd11f)
  • Loading branch information
lhotari authored and nikhil-ctds committed Dec 20, 2023
1 parent 16b8c87 commit 85e9436
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public void cleanup() throws Exception {

@Test
public void testEntryLookup() throws Exception {
@Cleanup
BookKeeper bk = pulsar.getBookKeeperClientFactory().create(
this.conf, null, null, Optional.empty(), null);

Expand Down Expand Up @@ -216,6 +217,7 @@ public void testEntryLookup() throws Exception {

@Test
public void testCleanupOldCompactedTopicLedger() throws Exception {
@Cleanup
BookKeeper bk = pulsar.getBookKeeperClientFactory().create(
this.conf, null, null, Optional.empty(), null);

Expand Down Expand Up @@ -845,6 +847,7 @@ public void testReadCompactedLatestMessageWithInclusive() throws Exception {

@Test
public void testCompactWithConcurrentGetCompactionHorizonAndCompactedTopicContext() throws Exception {
@Cleanup
BookKeeper bk0 = pulsar.getBookKeeperClientFactory().create(
this.conf, null, null, Optional.empty(), null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void setup() throws Exception {
@Override
public void cleanup() throws Exception {
super.internalCleanup();

bk.close();
if (compactionScheduler != null) {
compactionScheduler.shutdownNow();
}
Expand Down

0 comments on commit 85e9436

Please sign in to comment.