Skip to content

Commit

Permalink
Ensure that TestResourceManager is only closed once
Browse files Browse the repository at this point in the history
Without this PR the TestResourceManager gets closed 3 times,
which is causing some issues with new surefire versions

Relates to: quarkusio#10081
  • Loading branch information
geoand committed Jun 22, 2020
1 parent 9de653d commit 3a6b5c4
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ private ExtensionState doJavaStart(ExtensionContext context, Class<? extends Qua

System.setProperty("test.url", TestHTTPResourceManager.getUri(runningQuarkusApplication));

Closeable tm = testResourceManager;
Closeable shutdownTask = new Closeable() {
@Override
public void close() throws IOException {
Expand All @@ -219,21 +218,14 @@ public void close() throws IOException {
System.setProperty(entry.getKey(), val);
}
}
tm.close();
}
}
}
};
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
try {
shutdownTask.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
curatedApplication.close();
}
curatedApplication.close();
}
}, "Quarkus Test Cleanup Shutdown task"));
return new ExtensionState(testResourceManager, shutdownTask);
Expand Down

0 comments on commit 3a6b5c4

Please sign in to comment.