Skip to content

Commit 3dbbbad

Browse files
lhotarisrinath-ctds
authored andcommitted
[fix][test] Fix resource leaks in PulsarBrokerStarterTest (apache#24235)
(cherry picked from commit 3ebf917) (cherry picked from commit ecee3c8)
1 parent aa140b6 commit 3dbbbad

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pulsar-broker/src/test/java/org/apache/pulsar/PulsarBrokerStarterTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ public void testGlobalZooKeeperConfig() throws SecurityException, NoSuchMethodEx
283283
*/
284284
@Test
285285
public void testMainWithNoArgument() throws Exception {
286+
@Cleanup("shutdown")
286287
BrokerStarter brokerStarter = new BrokerStarter();
287288
@Cleanup
288289
StringWriter err = new StringWriter();
@@ -301,6 +302,7 @@ public void testMainWithNoArgument() throws Exception {
301302
public void testMainRunBookieAndAutoRecoveryNoConfig() throws Exception {
302303
File testConfigFile = createValidBrokerConfigFile();
303304
String[] args = {"-c", testConfigFile.getAbsolutePath(), "-rb", "-ra", "-bc", ""};
305+
@Cleanup("shutdown")
304306
BrokerStarter starter = new BrokerStarter();
305307
@Cleanup
306308
StringWriter err = new StringWriter();
@@ -319,6 +321,7 @@ public void testMainRunBookieAndAutoRecoveryNoConfig() throws Exception {
319321
public void testMainRunBookieRecoveryNoConfig() throws Exception {
320322
File testConfigFile = createValidBrokerConfigFile();
321323
String[] args = {"-c", testConfigFile.getAbsolutePath(), "-ra", "-bc", ""};
324+
@Cleanup("shutdown")
322325
BrokerStarter starter = new BrokerStarter();
323326
@Cleanup
324327
StringWriter err = new StringWriter();
@@ -336,6 +339,7 @@ public void testMainRunBookieRecoveryNoConfig() throws Exception {
336339
public void testMainRunBookieNoConfig() throws Exception {
337340
File testConfigFile = createValidBrokerConfigFile();
338341
String[] args = {"-c", testConfigFile.getAbsolutePath(), "-rb", "-bc", ""};
342+
@Cleanup("shutdown")
339343
BrokerStarter starter = new BrokerStarter();
340344
@Cleanup
341345
StringWriter err = new StringWriter();
@@ -353,6 +357,7 @@ public void testMainRunBookieNoConfig() throws Exception {
353357
public void testMainEnableRunBookieThroughBrokerConfig() throws Exception {
354358
File testConfigFile = createValidBrokerConfigFile();
355359
String[] args = {"-c", testConfigFile.getAbsolutePath()};
360+
@Cleanup("shutdown")
356361
BrokerStarter starter = new BrokerStarter();
357362
@Cleanup
358363
StringWriter err = new StringWriter();

0 commit comments

Comments
 (0)