You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2023/05/26 20:50:54 UTC
[activemq-artemis] 02/03: ARTEMIS-4215 Test adjustments
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 88f9fa494be3a91d9f38372f2cd77b288b81a9cd
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Wed May 24 17:13:01 2023 -0400
ARTEMIS-4215 Test adjustments
---
.../artemis/tests/smoke/infinite/InfiniteRedeliverySmokeTest.java | 1 -
.../artemis/tests/soak/interrupt/JournalFlushInterruptTest.java | 5 +++--
.../artemis/tests/unit/core/journal/impl/TimedBufferTest.java | 7 +++----
3 files changed, 6 insertions(+), 7 deletions(-)
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++) {