Skip to content

Commit 2f8baf1

Browse files
authored
Merge pull request #3863 from senivam/travisTripleBuild
Run intermittently failing tests on Travis in a separate profile
2 parents 02f2cb6 + 175cbe7 commit 2f8baf1

File tree

11 files changed

+38
-38
lines changed

11 files changed

+38
-38
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ cache:
1313
- .autoconf
1414
env:
1515
matrix:
16-
- TEST_SET="-Ptravis_e2e_skip"
17-
- TEST_SET="-Ptravis_e2e"
16+
- TEST_SET="-Ptravis_main"
17+
- TEST_SET="-fn -Dtest=BroadcasterTest,ClientCloseTest,ResponseWriterOutputStreamTest -DfailIfNoTests=false"
1818

1919
install: true
2020

media/sse/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@
7575
<artifactId>maven-bundle-plugin</artifactId>
7676
<inherited>true</inherited>
7777
</plugin>
78+
<plugin>
79+
<groupId>org.apache.maven.plugins</groupId>
80+
<artifactId>maven-surefire-plugin</artifactId>
81+
<configuration>
82+
<forkCount>1</forkCount>
83+
<reuseForks>false</reuseForks>
84+
<enableAssertions>false</enableAssertions>
85+
<excludes>
86+
<exclude>${exclude.sse.tests}</exclude>
87+
</excludes>
88+
</configuration>
89+
</plugin>
7890
</plugins>
7991
</build>
8092

media/sse/src/test/java/org/glassfish/jersey/media/sse/ClientCloseTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
*/
4444
public class ClientCloseTest extends JerseyTest {
4545

46+
private static final int LATCH_WAIT_TIMEOUT = 16;
47+
4648
/**
4749
* The test test that SSE connection is really closed when EventSource.close() is called.
4850
* <p/>
@@ -66,15 +68,15 @@ public void onEvent(final InboundEvent inboundEvent) {
6668
// Server sends 3 events we are interested in.
6769
IntStream.range(0, 3).forEach((i) -> assertEquals("OK",
6870
target("sse/send").request().get().readEntity(String.class)));
69-
assertTrue(eventLatch.await(5, TimeUnit.SECONDS));
71+
assertTrue(eventLatch.await(LATCH_WAIT_TIMEOUT, TimeUnit.SECONDS));
7072

7173
// After receiving the 3 events, we try to close.
7274
eventSource.close();
7375

7476
// Unfortunately the HTTPURLConnection is blocked in read() method, so it will close only after receiving the next event.
7577
assertEquals("OK", target("sse/send").request().get().readEntity(String.class));
7678
// Wait for the event that will unblock the HTTPURLConnection and result in sending FIN.
77-
assertTrue(eventLatch2.await(5, TimeUnit.SECONDS));
79+
assertTrue(eventLatch2.await(LATCH_WAIT_TIMEOUT, TimeUnit.SECONDS));
7880
// Now it is interesting. Client has sent FIN, but Grizzly does not listen for client input (selector READ key is
7981
// disabled), while streaming the response. For some reason we need to send 2 more events for Grizzly to notice
8082
// that the client is gone.

pom.xml

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,6 @@
764764
<properties>
765765
<release.tests.args>-Dskip.tests=true</release.tests.args>
766766
<skip.tests>true</skip.tests>
767-
<skip.e2e>true</skip.e2e>
768767
</properties>
769768
</profile>
770769
<profile>
@@ -1183,25 +1182,9 @@
11831182
11841183
the whole build is run as clean install but excludes several e2e tests because of the not grepped output
11851184
-->
1186-
<id>travis_e2e_skip</id>
1185+
<id>travis_main</id>
11871186
<properties>
1188-
<skip.e2e>true</skip.e2e>
1189-
</properties>
1190-
</profile>
1191-
<profile>
1192-
<!--
1193-
Profile is aimed to run the build on travis
1194-
due to travis limitations for output (max 4MB) this profile is used to run e2e tests only.
1195-
1196-
the only thing which is happen using throfile is run of e2e tests (without additional build or so)
1197-
everything is already build using travis_e2e_skip profile
1198-
1199-
the whole build is run as test -Ptravis_e2e
1200-
-->
1201-
<id>travis_e2e</id>
1202-
<properties>
1203-
<skip.e2e>false</skip.e2e>
1204-
<skip.tests>true</skip.tests>
1187+
<exclude.sse.tests>**/BroadcasterTest*,**/ClientCloseTest*,**/ResponseWriterOutputStreamTest*</exclude.sse.tests>
12051188
</properties>
12061189
</profile>
12071190
</profiles>
@@ -1995,6 +1978,6 @@
19951978
<xerces.version>2.11.0</xerces.version>
19961979
<xmlunit.version>1.6</xmlunit.version>
19971980
<yasson.version>1.0.1</yasson.version>
1998-
<skip.e2e>false</skip.e2e>
1981+
<exclude.sse.tests>none</exclude.sse.tests>
19991982
</properties>
20001983
</project>

tests/e2e-client/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<forkCount>1</forkCount>
4242
<reuseForks>false</reuseForks>
4343
<enableAssertions>false</enableAssertions>
44-
<skipTests>${skip.e2e}</skipTests>
4544
</configuration>
4645
</plugin>
4746
</plugins>

tests/e2e-entity/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
<forkCount>1</forkCount>
4242
<reuseForks>false</reuseForks>
4343
<enableAssertions>false</enableAssertions>
44-
<skipTests>${skip.e2e}</skipTests>
44+
<excludes>
45+
<exclude>${exclude.sse.tests}</exclude>
46+
</excludes>
4547
</configuration>
4648
</plugin>
4749
</plugins>

tests/e2e-server/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<forkCount>1</forkCount>
4242
<reuseForks>false</reuseForks>
4343
<enableAssertions>false</enableAssertions>
44-
<skipTests>${skip.e2e}</skipTests>
4544
</configuration>
4645
</plugin>
4746
</plugins>

tests/e2e-testng/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<forkCount>1</forkCount>
4646
<reuseForks>false</reuseForks>
4747
<enableAssertions>false</enableAssertions>
48-
<skipTests>${skip.e2e}</skipTests>
4948
</configuration>
5049
<dependencies>
5150
<dependency>

tests/e2e/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
<forkCount>1</forkCount>
4242
<reuseForks>false</reuseForks>
4343
<enableAssertions>false</enableAssertions>
44-
<skipTests>${skip.e2e}</skipTests>
44+
<excludes>
45+
<exclude>${exclude.sse.tests}</exclude>
46+
</excludes>
4547
</configuration>
4648
</plugin>
4749
</plugins>

tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/container/ResponseWriterOutputStreamTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
*/
4444
public class ResponseWriterOutputStreamTest extends JerseyContainerTest {
4545

46+
private static final String CHECK_STRING = "RESOURCE";
47+
4648
@Path("/")
4749
public static class Resource {
4850

@@ -53,23 +55,23 @@ public void get(final ContainerRequest context) throws IOException {
5355

5456
final ContainerResponse response = new ContainerResponse(context, Response.ok().build());
5557
final OutputStream os = context.getResponseWriter()
56-
.writeResponseStatusAndHeaders("RESOURCE".getBytes().length, response);
57-
os.write("RESOURCE".getBytes());
58+
.writeResponseStatusAndHeaders(CHECK_STRING.getBytes().length, response);
59+
os.write(CHECK_STRING.getBytes());
5860
os.close();
5961
}
6062

6163
@POST
6264
@Produces("text/plain")
63-
public void post(final ContainerRequest context) throws IOException {
65+
public synchronized void post(final ContainerRequest context) throws IOException {
6466
assertThat(context.getMethod(), is("POST"));
6567

6668
final String s = context.readEntity(String.class);
67-
assertEquals("RESOURCE", s);
69+
assertEquals(CHECK_STRING, s);
6870

6971
final ContainerResponse response = new ContainerResponse(context, Response.ok().build());
7072
final OutputStream os = context.getResponseWriter()
71-
.writeResponseStatusAndHeaders("RESOURCE".getBytes().length, response);
72-
os.write("RESOURCE".getBytes());
73+
.writeResponseStatusAndHeaders(s.getBytes().length, response);
74+
os.write(s.getBytes());
7375
os.close();
7476
}
7577
}
@@ -81,12 +83,12 @@ protected Application configure() {
8183

8284
@Test
8385
public void testGet() {
84-
assertThat(target().request().get(String.class), is("RESOURCE"));
86+
assertThat(target().request().get(String.class), is(CHECK_STRING));
8587
}
8688

8789
@Test
8890
public void testPost() {
89-
assertThat(target().request().post(Entity.text("RESOURCE"), String.class), is("RESOURCE"));
91+
assertThat(target().request().post(Entity.text(CHECK_STRING), String.class), is(CHECK_STRING));
9092
}
9193

9294
@Test

0 commit comments

Comments
 (0)