Skip to content

Commit b0e3741

Browse files
committed
4.x Intermittent pipeline test failure in SseClientTest.testSseJson1 #10471
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent 64ca086 commit b0e3741

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseBaseTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024 Oracle and/or its affiliates.
2+
* Copyright (c) 2023, 2025 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131

3232
class SseBaseTest {
3333

34+
private static final System.Logger LOGGER = System.getLogger(SseBaseTest.class.getName());
3435
private final WebServer webServer;
3536

3637
SseBaseTest() {
@@ -62,11 +63,14 @@ static void sseString2(ServerRequest req, ServerResponse res) throws Interrupted
6263
}
6364

6465
static void sseJson1(ServerRequest req, ServerResponse res) {
66+
LOGGER.log(System.Logger.Level.ERROR, "sseJson1 called");
6567
JsonObject json = Json.createObjectBuilder()
6668
.add("hello", "world")
6769
.build();
6870
try (SseSink sseSink = res.sink(SseSink.TYPE)) {
71+
LOGGER.log(System.Logger.Level.ERROR, "sseJson1 sseSink called");
6972
sseSink.emit(SseEvent.create(json));
73+
LOGGER.log(System.Logger.Level.ERROR, "sseJson1 emit called");
7074
}
7175
}
7276

@@ -84,10 +88,13 @@ public void setHello(String hello) {
8488
}
8589

8690
static void sseJson2(ServerRequest req, ServerResponse res) {
91+
LOGGER.log(System.Logger.Level.ERROR, "sseJson2 called");
8792
SseServerTest.HelloWorld json = new SseServerTest.HelloWorld();
8893
json.setHello("world");
8994
try (SseSink sseSink = res.sink(SseSink.TYPE)) {
95+
LOGGER.log(System.Logger.Level.ERROR, "sseJson2 sseSink called");
9096
sseSink.emit(SseEvent.create(json));
97+
LOGGER.log(System.Logger.Level.ERROR, "sseJson2 emit called");
9198
}
9299
}
93100

webserver/tests/sse/src/test/java/io/helidon/webserver/tests/sse/SseClientTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
@ServerTest
4444
class SseClientTest extends SseBaseTest {
4545

46+
private static final System.Logger LOGGER = System.getLogger(SseClientTest.class.getName());
4647
private final Http1Client client;
4748

4849
SseClientTest(WebServer webServer, Http1Client client) {
@@ -143,9 +144,12 @@ public void onClose() {
143144

144145
@Test
145146
void testSseJson1() throws InterruptedException {
147+
LOGGER.log(System.Logger.Level.ERROR, "testSseJson1 called");
146148
try (Http1ClientResponse r = client.get("/sseJson1").header(ACCEPT_EVENT_STREAM).request()) {
149+
LOGGER.log(System.Logger.Level.ERROR, "testSseJson1 client called");
147150
CountDownLatch latch = new CountDownLatch(1);
148151
r.source(SseSource.TYPE, event -> {
152+
LOGGER.log(System.Logger.Level.ERROR, "testSseJson1 source called");
149153
JsonObject json = event.data(JsonObject.class);
150154
assertThat(json, is(notNullValue()));
151155
assertThat(json.getString("hello"), is("world"));
@@ -157,9 +161,12 @@ void testSseJson1() throws InterruptedException {
157161

158162
@Test
159163
void testSseJson2() throws InterruptedException {
164+
LOGGER.log(System.Logger.Level.ERROR, "testSseJson2 called");
160165
try (Http1ClientResponse r = client.get("/sseJson2").header(ACCEPT_EVENT_STREAM).request()) {
166+
LOGGER.log(System.Logger.Level.ERROR, "testSseJson2 client called");
161167
CountDownLatch latch = new CountDownLatch(1);
162168
r.source(SseSource.TYPE, event -> {
169+
LOGGER.log(System.Logger.Level.ERROR, "testSseJson2 source called");
163170
HelloWorld json = event.data(HelloWorld.class, MediaTypes.APPLICATION_JSON);
164171
assertThat(json, is(notNullValue()));
165172
assertThat(json.getHello(), is("world"));

0 commit comments

Comments
 (0)