Skip to content

Commit 74ea30f

Browse files
authored
Merge pull request #395 from bstansberry/Issue_394
[Issue_394] If ReactiveStreamsPublisherTckTest.createPublisher is cal…
2 parents 691b493 + 24da017 commit 74ea30f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tck/src/main/java/org/eclipse/microprofile/rest/client/tck/sse/ReactiveStreamsPublisherTckTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ public Publisher<InboundSseEvent> createPublisher(long elements) {
102102

103103
CountDownLatch stopLatch = new CountDownLatch(1);
104104
try {
105+
if (cleanupLatch != null) {
106+
// We null out cleanupLatch in a @BeforeTest method, so if it is not null
107+
// we must be in a test that calls this multiple times in a single @Test method,
108+
// e.g. a stochastic test. In this case we can't rely on having awaited cleanupLatch
109+
// in our @AfterTest method, and we need to do it ourselves.
110+
if (!cleanupLatch.await(30, TimeUnit.SECONDS)) {
111+
// Just log; maybe by the time we create a new server the old one will be stopped.
112+
LOG.error("Server did not close long after test completed");
113+
}
114+
}
105115
cleanupLatch = new CountDownLatch(1);
106116
AtomicReference<Throwable> serverException = launchServer(stopLatch, es -> {
107117
for (long i = 0; i < elements; i++) {

0 commit comments

Comments
 (0)