Skip to content

Commit

Permalink
Adding debug in Jenkins to spot the issue
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
  • Loading branch information
jbescos committed Jul 8, 2021
1 parent b977231 commit 740977f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -99,7 +101,7 @@ public void hangAllRequestsStatus200() throws InterruptedException, ExecutionExc
assertTrue(requests.await(20, TimeUnit.SECONDS));
latch.countDown();
for (Future<Response> response : responses) {
assertEquals(200, response.get().getStatus());
assertEquals(threadDump(), 200, response.get().getStatus());
}
}
executor.shutdown();
Expand All @@ -118,7 +120,7 @@ public void randomnessStatus200() throws InterruptedException, ExecutionExceptio
responses.add(future);
}
for (Future<Response> response : responses) {
assertEquals(200, response.get().getStatus());
assertEquals(threadDump(), 200, response.get().getStatus());
}
}
executor.shutdown();
Expand All @@ -136,4 +138,15 @@ public void asyncTest() throws InterruptedException, ExecutionException {
Future<Response> response = target("/test/2").request().async().get();
assertEquals(200, response.get().getStatus());
}

private String threadDump() {
StringBuilder builder = new StringBuilder();
for (Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) {
builder.append(entry.getKey().getName()).append("\r\n");
for (StackTraceElement element : entry.getValue()) {
builder.append("\t").append(element).append("\r\n");
}
}
return builder.toString();
}
}
2 changes: 1 addition & 1 deletion etc/jenkins/jenkins_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

export DEBUG=true

mvn -V -U -B -e clean install glassfish-copyright:check -Dcopyright.quiet=false -Dsurefire.systemPropertiesFile=${WORKSPACE}/etc/jenkins/systemPropertiesFile
mvn -X -V -U -B -e clean install glassfish-copyright:check -Dcopyright.quiet=false -Dsurefire.systemPropertiesFile=${WORKSPACE}/etc/jenkins/systemPropertiesFile

0 comments on commit 740977f

Please sign in to comment.