This is an automated email from the ASF dual-hosted git repository. cshannon pushed a commit to branch activemq-5.19.x in repository https://gitbox.apache.org/repos/asf/activemq.git
commit 009b4f3cbb1469389497ab6ffe2df68ce897dd2c Author: Jean-Louis Monteiro <[email protected]> AuthorDate: Mon Dec 15 11:40:07 2025 +0100 [AMQ-9819]: harden #testConsumeAsyncTimeout() so it does not rely on a specific order of the 2 async requests made (cherry picked from commit a53f05015b01b4572ad1b6a8f0a6e62fb8b18785) --- .../src/test/java/org/apache/activemq/web/RestTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java index db923afcf8..91b927ad04 100644 --- a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java +++ b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java @@ -92,9 +92,12 @@ public class RestTest extends JettyTestSupport { // try a second request while the first is running, this should get a 500 error since the first is still running and // concurrent access to the same consumer is not allowed Future<Result> errorResult = asyncRequest(httpClient, "http://localhost:" + port + "/message/test?readTimeout=10000&type=queue&clientId=test", new StringBuffer()); - assertEquals(HttpStatus.INTERNAL_SERVER_ERROR_500, errorResult.get().getResponse().getStatus()); - //After the original request finishes, verify 204 and not 500 error - assertEquals(HttpStatus.NO_CONTENT_204, result.get().getResponse().getStatus()); + int status1 = result.get().getResponse().getStatus(); + int status2 = errorResult.get().getResponse().getStatus(); + // Order of arrival is nondeterministic; one must fail (500) while the other times out (204). + assertTrue("Expected one 204 and one 500 but got " + status1 + " and " + status2, + (status1 == HttpStatus.NO_CONTENT_204 && status2 == HttpStatus.INTERNAL_SERVER_ERROR_500) || + (status2 == HttpStatus.NO_CONTENT_204 && status1 == HttpStatus.INTERNAL_SERVER_ERROR_500)); // AMQ-9481 - test to make sure we can re-use the consumer after timeout by trying again and ensuring // no 500 error. Before the fix in AMQ-9418 this would fail even after the previous request timed out --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
