From 2ae58dd3d932eec1c6d16cca4d5a5514fc4dcedc Mon Sep 17 00:00:00 2001 From: Brian Pontarelli Date: Sat, 7 Sep 2024 08:14:02 -0600 Subject: [PATCH] Removing tests that can fail periodically from the Github action by putting them in a new test group and excluding it. Also, performance tests now run by default. --- .github/workflows/test.yml | 2 +- build.savant | 9 ++++++--- java-http.ipr | 3 ++- src/test/java/io/fusionauth/http/BaseTest.java | 2 +- src/test/java/io/fusionauth/http/CoreTest.java | 10 +++++----- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8468393..83b7d77 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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() diff --git a/build.savant b/build.savant index ef80863..701cb97 100644 --- a/build.savant +++ b/build.savant @@ -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) diff --git a/java-http.ipr b/java-http.ipr index 11372a7..3b37e61 100644 --- a/java-http.ipr +++ b/java-http.ipr @@ -35,10 +35,11 @@ diff --git a/src/test/java/io/fusionauth/http/BaseTest.java b/src/test/java/io/fusionauth/http/BaseTest.java index 411e20b..d31914e 100644 --- a/src/test/java/io/fusionauth/http/BaseTest.java +++ b/src/test/java/io/fusionauth/http/BaseTest.java @@ -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())); diff --git a/src/test/java/io/fusionauth/http/CoreTest.java b/src/test/java/io/fusionauth/http/CoreTest.java index 4e18ee8..f2e08ac 100644 --- a/src/test/java/io/fusionauth/http/CoreTest.java +++ b/src/test/java/io/fusionauth/http/CoreTest.java @@ -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"); @@ -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 @@ -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) -> { @@ -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. @@ -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) -> {