Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]

2026-04-02 Thread via GitHub


jbonofre merged PR #1862:
URL: https://github.com/apache/activemq/pull/1862


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact




Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]

2026-03-31 Thread via GitHub


jbonofre commented on PR #1862:
URL: https://github.com/apache/activemq/pull/1862#issuecomment-4163094457

   @gurpartap3697 good job ! I will merge as soon as CI is green.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact




Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]

2026-03-30 Thread via GitHub


gurpartap3697 commented on code in PR #1862:
URL: https://github.com/apache/activemq/pull/1862#discussion_r3011693901


##
activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/XACompletionTest.java:
##
@@ -249,6 +249,7 @@ public void testStatsAndBrowseAfterAckPreparedRolledback() 
throws Exception {
 resource.recover(XAResource.TMSTARTRSCAN);
 resource.recover(XAResource.TMNOFLAGS);
 
+Wait.waitFor(() -> proxy.getInFlightCount() == 0L && 
proxy.cursorSize() == 0);

Review Comment:
   Good point — thanks for calling that out.
   
   I initially assumed that inFlightCount == 0 would imply the queue state 
(including queueSize) had fully settled. I've updated the wait condition to 
include getQueueSize()



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact




Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]

2026-03-30 Thread via GitHub


gurpartap3697 commented on PR #1862:
URL: https://github.com/apache/activemq/pull/1862#issuecomment-4157532044

   Thanks @jbonofre for feedback! I updated the pr with suggested changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact




Re: [PR] Fix flaky XACompletionTest by adding wait for async states [activemq]

2026-03-30 Thread via GitHub


jbonofre commented on code in PR #1862:
URL: https://github.com/apache/activemq/pull/1862#discussion_r3011599712


##
activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/XACompletionTest.java:
##
@@ -249,6 +249,7 @@ public void testStatsAndBrowseAfterAckPreparedRolledback() 
throws Exception {
 resource.recover(XAResource.TMSTARTRSCAN);
 resource.recover(XAResource.TMNOFLAGS);
 
+Wait.waitFor(() -> proxy.getInFlightCount() == 0L && 
proxy.cursorSize() == 0);

Review Comment:
   I suggest to wrap `Watit.waitFor()` in a `assertTrue` for better diagnostics 
on failure:
   
   
   ```suggestion
   assertTrue("Timed out waiting for inFlight and cursor to clear", 


   
 Wait.waitFor(() -> proxy.getInFlightCount() == 0L && 
proxy.cursorSize() == 0)); 
   ```



##
activemq-unit-tests/src/test/java/org/apache/activemq/store/jdbc/XACompletionTest.java:
##
@@ -249,6 +249,7 @@ public void testStatsAndBrowseAfterAckPreparedRolledback() 
throws Exception {
 resource.recover(XAResource.TMSTARTRSCAN);
 resource.recover(XAResource.TMNOFLAGS);
 
+Wait.waitFor(() -> proxy.getInFlightCount() == 0L && 
proxy.cursorSize() == 0);

Review Comment:
   The wait condition doesn't cover `getQueueSize()`. The wait checks 
`getInFlightCount() == 0 && cursorSize() == 0`, but the very next assertion 
also checks `getQueueSize() == 10`.
   
   If `getQueueSize()` is also subject to async updates, it could still flake. 
   
   Worth considering whether to include it in the wait condition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact