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
This commit is contained in:
parent
fbb622ae69
commit
23a30b6158
|
@ -2311,17 +2311,17 @@ public class QueueControlTest extends ManagementTestBase {
|
||||||
|
|
||||||
ClientProducer producer = session.createProducer(address);
|
ClientProducer producer = session.createProducer(address);
|
||||||
producer.send(session.createMessage(durable));
|
producer.send(session.createMessage(durable));
|
||||||
Assert.assertEquals(1, getMessagesAdded(queueControl));
|
Wait.assertEquals(1, () -> getMessagesAdded(queueControl));
|
||||||
producer.send(session.createMessage(durable));
|
producer.send(session.createMessage(durable));
|
||||||
Assert.assertEquals(2, getMessagesAdded(queueControl));
|
Wait.assertEquals(2, () -> getMessagesAdded(queueControl));
|
||||||
|
|
||||||
consumeMessages(2, session, queue);
|
consumeMessages(2, session, queue);
|
||||||
|
|
||||||
Assert.assertEquals(2, getMessagesAdded(queueControl));
|
Wait.assertEquals(2, () -> getMessagesAdded(queueControl));
|
||||||
|
|
||||||
queueControl.resetMessagesAdded();
|
queueControl.resetMessagesAdded();
|
||||||
|
|
||||||
Assert.assertEquals(0, getMessagesAdded(queueControl));
|
Wait.assertEquals(0, () -> getMessagesAdded(queueControl));
|
||||||
|
|
||||||
session.deleteQueue(queue);
|
session.deleteQueue(queue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue