diff --git a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java index fbaa0f6281..a960023e40 100644 --- a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java +++ b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java @@ -146,7 +146,6 @@ public class InfiniteRedeliverySmokeTest extends SmokeTestBase { // it should be max 10 actually, I'm just leaving some space for future changes, // as the real test I'm after here is the broker should clean itself up Wait.assertTrue(() -> fileFactory.listFiles("amq").size() <= 20); - Assert.assertTrue("there are too many files created", numberOfFiles <= 20); } } } diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java index 8f00dd072f..e2dcabcc53 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/interrupt/JournalFlushInterruptTest.java @@ -30,6 +30,7 @@ import org.apache.activemq.artemis.api.core.management.ObjectNameBuilder; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.util.CFUtil; +import org.apache.activemq.artemis.tests.util.Wait; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -72,7 +73,7 @@ public class JournalFlushInterruptTest extends SoakTestBase { QueueControl queueControl = getQueueControl(liveURI, liveNameBuilder, queueName, queueName, RoutingType.ANYCAST, 5000); - Assert.assertEquals(messageCount, queueControl.getMessageCount()); + Wait.assertEquals(messageCount, queueControl::getMessageCount, 5000); Thread.sleep(100); killProcess(serverProcess); @@ -82,7 +83,7 @@ public class JournalFlushInterruptTest extends SoakTestBase { waitForServerToStart("tcp://localhost:61616", "artemis", "artemis", 5000); queueControl = getQueueControl(liveURI, liveNameBuilder, queueName, queueName, RoutingType.ANYCAST, 5000); - Assert.assertEquals(messageCount, queueControl.getMessageCount()); + Wait.assertEquals(messageCount, queueControl::getMessageCount); } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java index 157dc8e268..3e02bb28ed 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java @@ -34,6 +34,7 @@ import org.apache.activemq.artemis.core.journal.EncodingSupport; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.utils.Env; import org.apache.activemq.artemis.utils.ReusableLatch; +import org.apache.activemq.artemis.utils.Wait; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -180,7 +181,7 @@ public class TimedBufferTest extends ActiveMQTestBase { // simulating a low load period timedBuffer.addBytes(buff, true, callback); - Thread.sleep(1000); + Thread.sleep(100); timedBuffer.addBytes(buff, true, callback); Assert.assertTrue(latchFlushed.await(5, TimeUnit.SECONDS)); latchFlushed.setCount(5); @@ -494,9 +495,7 @@ public class TimedBufferTest extends ActiveMQTestBase { timedBuffer.checkSize(10); timedBuffer.addBytes(buff, false, dummyCallback); - Thread.sleep(200); - - Assert.assertEquals(count + 1, flushTimes.get()); + Wait.assertEquals(count + 1, () -> flushTimes.get(), 2000); bytes = new byte[10]; for (int j = 0; j < 10; j++) {