Skip to content

Commit

Permalink
Removing tests that can fail periodically from the Github action by p…
Browse files Browse the repository at this point in the history
…utting them in a new test group and excluding it. Also, performance tests now run by default.
  • Loading branch information
voidmain committed Sep 7, 2024
1 parent 09dc503 commit 2ae58dd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: |
export JAVA_HOME=${JAVA_HOME_17_X64}
export PATH=~/dev/savant/current/bin:${JAVA_HOME}/bin:$PATH
sb clean int
sb clean int --excludePerformance --excludeTimeouts
shell: bash
- name: Archive TestNG reports
if: failure()
Expand Down
9 changes: 6 additions & 3 deletions build.savant
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ target(name: "jar", description: "Builds the project JARs", dependsOn: ["compile
}

target(name: "test", description: "Runs the project's tests", dependsOn: ["jar"]) {
var exclude = ["performance"]
if (switches.has("includePerformance")) {
exclude = []
var exclude = []
if (switches.has("excludePerformance")) {
exclude << "performance"
}
if (switches.has("excludeTimeouts")) {
exclude << "timeouts"
}

javaTestNG.test(exclude: exclude)
Expand Down
3 changes: 2 additions & 1 deletion java-http.ipr
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@
<inspection_tool class="groupsTestNG" enabled="true" level="WARNING" enabled_by_default="true">
<option name="groups">
<value>
<list size="3">
<list size="4">
<item index="0" class="java.lang.String" itemvalue="performance" />
<item index="1" class="java.lang.String" itemvalue="unit" />
<item index="2" class="java.lang.String" itemvalue="acceptance" />
<item index="3" class="java.lang.String" itemvalue="timeouts" />
</list>
</value>
</option>
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/fusionauth/http/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public void sendBadRequest(String message) {
}
}

@AfterSuite(groups = "acceptance")
@AfterSuite
public void tearDown() {
System.out.println("\nTests began : " + hh_mm_ss_SSS.format(TestStarted));
System.out.println("Tests ended : " + hh_mm_ss_SSS.format(ZonedDateTime.now()));
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/io/fusionauth/http/CoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void hugeHeaders(String scheme) throws Exception {
}
}

@Test
@Test(groups = "timeouts")
public void initialReadTimeout() {
// This test simulates if the client doesn't send bytes for the initial timeout
HTTPHandler handler = (req, res) -> fail("Should not be called");
Expand All @@ -279,7 +279,7 @@ public void initialReadTimeout() {
assertEquals(instrumenter.getClosedConnections(), 1);
}

@Test
@Test(groups = "timeouts")
public void keepAliveTimeout() {
// This test only works with GET and the URLConnection because this setup will re-submit the same request if the Keep-Alive connection
// is terminated by the server
Expand Down Expand Up @@ -541,7 +541,7 @@ public void serverClosesSockets(String scheme) {
}
}

@Test
@Test(groups = "timeouts")
public void serverTimeout() throws Exception {
// This test simulates if the server has a long-running thread that doesn't write fast enough
HTTPHandler handler = (req, res) -> {
Expand Down Expand Up @@ -721,7 +721,7 @@ public void simplePost(String scheme, int responseBufferSize) throws Exception {
}
}

@Test(dataProvider = "schemes")
@Test(dataProvider = "schemes", groups = "timeouts")
public void slowClient(String scheme) throws Exception {
// Test a slow connection where the HTTP server is blocked because we cannot write to the output stream as fast as we'd like. The
// default buffer on macOS seems to be 768k (from my testing). I set this to 8MB which should hopefully cause the writes to back up.
Expand Down Expand Up @@ -770,7 +770,7 @@ public void slowClient(String scheme) throws Exception {
}
}

@Test
@Test(groups = "timeouts")
public void slowHandler() {
AtomicBoolean called = new AtomicBoolean(false);
HTTPHandler handler = (req, res) -> {
Expand Down

0 comments on commit 2ae58dd

Please sign in to comment.