From 18f32da373d3f64dc458527e9058d5d8dfbcce28 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 2 Aug 2021 05:06:37 -0700 Subject: [PATCH] Issue #5684 - make test less strict due to system speed issues Signed-off-by: Joakim Erdfelt --- .../org/eclipse/jetty/servlets/AbstractDoSFilterTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/AbstractDoSFilterTest.java b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/AbstractDoSFilterTest.java index 32cfd45e9af..58ab487c4e0 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/AbstractDoSFilterTest.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/servlets/AbstractDoSFilterTest.java @@ -48,6 +48,7 @@ import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.lessThan; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -302,7 +303,8 @@ public abstract class AbstractDoSFilterTest String responses = doRequests(request1 + request2 + request1 + request2 + request1, 2, 1100, 1100, last); assertEquals(11, count(responses, "HTTP/1.1 200 OK")); - assertEquals(0, count(responses, "DoSFilter: delayed")); + // This test is system speed dependent, so allow some (20%-ish) requests to be delayed, but not more. + assertThat("delayed count", count(responses, "DoSFilter: delayed"), lessThan(2)); // alternate between sessions responses = doRequests(request1 + request2 + request1 + request2 + request1, 2, 250, 250, last);