Skip to content

Commit

Permalink
Improve flaky test FilterTest (with after filter) (#114)
Browse files Browse the repository at this point in the history
The after filter actions can occur after the response has been sent back to the client, so the client thread can execute before the actual after filter action has completed for these tests.

Co-authored-by: Josiah Noel <[email protected]>
  • Loading branch information
rbygrave and SentryMan authored Dec 2, 2024
1 parent be45a30 commit 81e0647
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion avaje-jex/src/test/java/io/avaje/jex/core/FilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void get() {

clearAfter();
res = pair.request().path("two").GET().asString();
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
assertHasBeforeAfterAll(res);
assertNoBeforeAfterTwo(res);
}
Expand Down Expand Up @@ -108,6 +107,7 @@ private void assertNoBeforeAfterTwo(HttpResponse<String> res) {
private void assertHasBeforeAfterAll(HttpResponse<String> res) {
assertThat(res.statusCode()).isLessThan(300);
assertThat(res.headers().firstValue("before-all")).get().isEqualTo("set");
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(2));
assertThat(afterAll.get()).isEqualTo("set");
}
}

0 comments on commit 81e0647

Please sign in to comment.