GitHub user jdanekrh opened a pull request: https://github.com/apache/activemq-artemis/pull/2225
Fix flaky QueueControl tests You can merge this pull request into a Git repository by running: $ git pull https://github.com/jdanekrh/activemq-artemis jd_flaky_queue_control_tests Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/2225.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2225 ---- commit fba805cb85a1d7ef5425e9e16f39697b49ea0ef0 Author: Jiri Danek <jdanek@...> Date: 2018-08-07T14:56:20Z NO-JIRA fix flaky test QueueControlTest#testListMessagesWithEmptyFilter The below error is prevented by using Wait.assertEquals where Assert.assertEquals was used previously. java.lang.AssertionError: Expected :2 Actual :1 [...] at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.testListMessagesWithEmptyFilter(QueueControlTest.java:827) commit 2c8930f7081c081b49ce1c9117aa6098d4690ae6 Author: Jiri Danek <jdanek@...> Date: 2018-08-07T14:59:30Z NO-JIRA fix flaky test QueueControlTest#testListMessagesWithNullFilter The below error is prevented by using Wait.assertEquals where Assert.assertEquals was used previously. java.lang.AssertionError: Expected :2 Actual :1 [...] at org.junit.Assert.assertEquals(Assert.java:542) at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.testListMessagesWithNullFilter(QueueControlTest.java:804) commit 7222133993b54fdb51979c69a02764670a32ee2e Author: Jiri Danek <jdanek@...> Date: 2018-08-07T15:10:00Z NO-JIRA fix flaky test QueueControlTest#testResetMessagesAdded The occasional assertion error is prevented by using Wait.assertEquals where Assert.assertEquals was used previously. I did not observe the timing issue on all asserts (only on the first two), but there is no harm in replacing them all. java.lang.AssertionError: Expected :2 Actual :1 commit f8e97abbf381a8bf6eb4fb955d9108de1aa33f8c Author: Jiri Danek <jdanek@...> Date: 2018-08-07T16:22:57Z ARTEMIS-2016 fix flaky test QueueControlTest#testRemoveAllWithPagingMode Parameters going into Wait.waitFor were originally wrong, because `durationMillis: 3, sleepMillis: 100` means you would test the condition only once. This commit is changing the durationMillis from 3ms to 3s, swapping the two numbers (duration 100ms, sleep 3ms) would also be reasonable, I think. Next, Wait.assertEquals is here being used, instead of Assert.assertTrue. I saw the test fail only once, and never was able to reproduce it again, but I think this commit does improve the test and so it is worthwhile. java.lang.AssertionError at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.assertMetrics(QueueControlTest.java:2651) at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.assertMessageMetrics(QueueControlTest.java:2615) at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.testRemoveAllWithPagingMode(QueueControlTest.java:1554) commit 099b7640cf5936b402c8c820e3679db41e963a98 Author: Jiri Danek <jdanek@...> Date: 2018-08-07T18:02:41Z NO-JIRA fix flaky tests QueueControlTest#testChangeMessagePriority{,WithInvalidValue} The occasional assertion error is prevented by using Wait.assertEquals where Assert.assertEquals was used previously. commit d1a0356f1cd8c25dc7a33f8d97a3cca91f8ff575 Author: Jiri Danek <jdanek@...> Date: 2018-08-07T18:16:18Z NO-JIRA fix flaky tests QueueControlTest#testResetMessagesExpired The occasional assertion error is prevented by using Wait.assertEquals where Assert.assertEquals was used previously. java.lang.AssertionError: Expected :1 Actual :0 [...] at org.junit.Assert.assertEquals(Assert.java:542) at org.apache.activemq.artemis.tests.integration.management.QueueControlTest.testResetMessagesExpired(QueueControlTest.java:2370) ---- ---