Skip to content

Commit

Permalink
[UNDERTOW-2400] At AsyncResponseWriterOnPostServlet for servlet tests…
Browse files Browse the repository at this point in the history
…, configure a bigger timeout in the async context, to prevent ci failures caused by slowness in ResponseWriterTestCase.testAsyncRespondBeforeRead

Also, clear the exception field in the superclass ResponseWriterOnPostServlet after reading it, to prevent a non null exception from being read twice, which could cause false test failures

Signed-off-by: Flavia Rainone <[email protected]>
  • Loading branch information
fl4via committed Jun 13, 2024
1 parent a41521a commit 786f839
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected void doPost(final HttpServletRequest req, final HttpServletResponse re
throw new IllegalArgumentException("not a test " + test);
}
final AsyncContext asyncContext = req.startAsync();
asyncContext.setTimeout(50000);
new Thread(()->{
try {
HttpServletResponse response = (HttpServletResponse) asyncContext.getResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ protected void doPost(final HttpServletRequest req, final HttpServletResponse re
}

public static Throwable getExceptionIfAny() {
return exception;
Throwable result = exception;
exception = null;
return result;
}
}

0 comments on commit 786f839

Please sign in to comment.