Skip to content

Commit

Permalink
Merge pull request #24440 from aloubyansky/test-plan-deployment-cl
Browse files Browse the repository at this point in the history
Execute test plan with the deployment classloader as the TCCL
  • Loading branch information
aloubyansky authored Mar 22, 2022
2 parents 1fc794c + d052ee2 commit 619288d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public FilterResult apply(TestDescriptor testDescriptor) {
return new Runnable() {
@Override
public void run() {
final ClassLoader origCl = Thread.currentThread().getContextClassLoader();
try {
synchronized (JunitTestRunner.this) {
testsRunning = true;
Expand Down Expand Up @@ -222,6 +223,8 @@ public void quarkusStarting() {

Map<String, Map<UniqueId, TestResult>> resultsByClass = new HashMap<>();
AtomicReference<TestIdentifier> currentNonDynamicTest = new AtomicReference<>();

Thread.currentThread().setContextClassLoader(tcl);
launcher.execute(testPlan, new TestExecutionListener() {

@Override
Expand Down Expand Up @@ -396,6 +399,7 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e
throw new RuntimeException(e);
}
} finally {
Thread.currentThread().setContextClassLoader(origCl);
synchronized (JunitTestRunner.this) {
testsRunning = false;
if (aborted) {
Expand Down

0 comments on commit 619288d

Please sign in to comment.