Skip to content

Commit

Permalink
[fix apache#9432] Fix NPEs in test cleanup methods (apache#9442)
Browse files Browse the repository at this point in the history
Co-authored-by: Sijie Guo <[email protected]>
  • Loading branch information
Wzhipeng and sijie authored Feb 12, 2021
1 parent 731c18f commit 1318aa1
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public void setup() throws Exception {
public void cleanup() throws Exception {
super.internalCleanup();

compactionScheduler.shutdownNow();
if (compactionScheduler != null) {
compactionScheduler.shutdownNow();
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ protected void cleanup() throws Exception {
executor.shutdownNow();

super.internalCleanup();
service.close();
proxyServer.stop();
if (service != null) {
service.close();
}
if (proxyServer != null) {
proxyServer.stop();
}
log.info("Finished Cleaning Up Test setup");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ protected void setup() throws Exception {
@Override
protected void cleanup() throws Exception {
internalCleanup();
service.close();
if (service != null) {
service.close();
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ public void setup() throws Exception {
protected void cleanup() throws Exception {
super.resetConfig();
super.internalCleanup();
service.close();
proxyServer.stop();
if (service != null) {
service.close();
}
if (proxyServer != null) {
proxyServer.stop();
}
log.info("Finished Cleaning Up Test setup");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ public void setup() throws Exception {
@AfterMethod(alwaysRun = true)
protected void cleanup() throws Exception {
super.cleanup();
service.close();
proxyServer.stop();
if (service != null) {
service.close();
}
if (proxyServer != null) {
proxyServer.stop();
}
log.info("Finished Cleaning Up Test setup");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ public void setup() throws Exception {
@AfterMethod(alwaysRun = true)
protected void cleanup() throws Exception {
super.internalCleanup();
service.close();
proxyServer.stop();
if (service != null) {
service.close();
}
if (proxyServer != null) {
proxyServer.stop();
}
log.info("Finished Cleaning Up Test setup");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ protected void cleanup() throws Exception {
executor.shutdownNow();

super.internalCleanup();
service.close();
proxyServer.stop();
if (service != null) {
service.close();
}
if (proxyServer != null) {
proxyServer.stop();
}
log.info("Finished Cleaning Up Test setup");

}
Expand Down

0 comments on commit 1318aa1

Please sign in to comment.