diff --git a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java index d389c50c6d7..7c91ea11b33 100644 --- a/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java +++ b/webserver/tests/webserver/src/test/java/io/helidon/webserver/tests/WebServerStopIdleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Oracle and/or its affiliates. + * Copyright (c) 2023, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,9 @@ import io.helidon.webserver.WebServer; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -29,7 +32,20 @@ class WebServerStopIdleTest { @Test + @DisabledOnOs(OS.WINDOWS) void stopWhenIdleExpectTimelyStop() { + stopWhenIdleExpectTimelyStop(500); + } + + @Test + @EnabledOnOs( + value = OS.WINDOWS, + disabledReason = "Slow pipeline runner make it stop a few millisecond later") + void stopWhenIdleExpectTimelyStopWindows() { + stopWhenIdleExpectTimelyStop(505); + } + + void stopWhenIdleExpectTimelyStop(int maximumTime) { WebServer webServer = WebServer.builder() .routing(router -> router.get("ok", (req, res) -> res.send("ok"))) .build(); @@ -46,6 +62,6 @@ void stopWhenIdleExpectTimelyStop() { long startMillis = System.currentTimeMillis(); webServer.stop(); int stopExecutionTimeInMillis = (int) (System.currentTimeMillis() - startMillis); - assertThat(stopExecutionTimeInMillis, is(lessThan(500))); + assertThat(stopExecutionTimeInMillis, is(lessThan(maximumTime))); } }