Skip to content

Commit a6b11f7

Browse files
authored
[AMQ-8525] Fix random failures and run an eligible subset in parallel (#1542)
1 parent f25bc52 commit a6b11f7

File tree

821 files changed

+11449
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

821 files changed

+11449
-613
lines changed

activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ private void corruptLocation(Location toCorrupt) throws IOException {
394394

395395
private void corruptBatchCheckSumSplash(int id) throws Exception{
396396
Collection<DataFile> files =
397-
((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).getStore().getJournal().getFileMap().values();
397+
((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).getStore().getJournal().getFileMap().values();
398398
DataFile dataFile = (DataFile) files.toArray()[0];
399399
RecoverableRandomAccessFile randomAccessFile = dataFile.openRandomAccessFile();
400400

@@ -425,7 +425,7 @@ private void corruptBatchCheckSumSplash(int id) throws Exception{
425425

426426
private void corruptBatchEndEof(int id) throws Exception{
427427
Collection<DataFile> files =
428-
((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).getStore().getJournal().getFileMap().values();
428+
((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).getStore().getJournal().getFileMap().values();
429429
DataFile dataFile = (DataFile) files.toArray()[id];
430430
RecoverableRandomAccessFile randomAccessFile = dataFile.openRandomAccessFile();
431431

@@ -449,7 +449,7 @@ private void corruptOrderIndex(final int num, final int size) throws Exception {
449449
@Override
450450
public void execute(Transaction tx) throws IOException {
451451
StoredDestination sd = kahaDbStore.getStoredDestination(kahaDbStore.convert(
452-
(ActiveMQQueue)destination), tx);
452+
(ActiveMQQueue)destination), tx);
453453
int i = 1;
454454
for (Iterator<Entry<Long, MessageKeys>> iterator = sd.orderIndex.iterator(tx); iterator.hasNext();) {
455455
Entry<Long, MessageKeys> entry = iterator.next();

activemq-unit-tests/pom.xml

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
<name>ActiveMQ :: Unit Tests</name>
3030
<description>The ActiveMQ Message Broker and Client Unit Tests</description>
3131

32+
<properties>
33+
<surefire.version>3.5.3</surefire.version>
34+
</properties>
35+
3236
<dependencies>
3337

3438
<!-- =============================== -->
@@ -391,12 +395,40 @@
391395
</configuration>
392396
</plugin>
393397
<plugin>
398+
<groupId>org.apache.maven.plugins</groupId>
394399
<artifactId>maven-surefire-plugin</artifactId>
400+
<version>${surefire.version}</version>
395401
<configuration>
396402
<forkCount>1</forkCount>
397403
<reuseForks>false</reuseForks>
398-
<forkedProcessTimeoutInSeconds>3600</forkedProcessTimeoutInSeconds>
404+
<enableProcessChecker>all</enableProcessChecker>
405+
<forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds> <!-- max time tests may run -->
406+
<forkedProcessExitTimeoutInSeconds>30</forkedProcessExitTimeoutInSeconds> <!-- max time JVM may hang after tests -->
399407
<runOrder>alphabetical</runOrder>
408+
<reportFormat>plain</reportFormat>
409+
<failIfNoTests>false</failIfNoTests>
410+
<excludedGroups>org.apache.activemq.test.annotations.ParallelTest</excludedGroups>
411+
<systemPropertyVariables>
412+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/</org.apache.activemq.default.directory.prefix>
413+
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
414+
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
415+
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
416+
</systemPropertyVariables>
417+
<consoleOutputReporter>
418+
<disable>true</disable>
419+
</consoleOutputReporter>
420+
<statelessTestsetInfoReporter
421+
implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
422+
<printStacktraceOnError>true</printStacktraceOnError>
423+
<printStacktraceOnFailure>true</printStacktraceOnFailure>
424+
<printStdoutOnError>true</printStdoutOnError>
425+
<printStdoutOnFailure>true</printStdoutOnFailure>
426+
<printStderrOnError>true</printStderrOnError>
427+
<printStderrOnFailure>true</printStderrOnFailure>
428+
</statelessTestsetInfoReporter>
429+
<includes>
430+
<include>**/*Test.*</include>
431+
</includes>
400432
<excludes>
401433
<!-- temporarily exclude failing tests so that CI works; fix asap and reenable -->
402434
<exclude>**/AMQ4092Test.java</exclude>
@@ -422,14 +454,47 @@
422454
<exclude>**/StartAndConcurrentStopBrokerTest.java</exclude>
423455
<exclude>**/BlobTransferPolicyUriTest.java</exclude>
424456
</excludes>
425-
<systemPropertyVariables>
426-
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
427-
<org.apache.activemq.default.directory.prefix>target/</org.apache.activemq.default.directory.prefix>
428-
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
429-
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
430-
</systemPropertyVariables>
431457
</configuration>
458+
<executions>
459+
<execution>
460+
<id>parallel</id>
461+
<phase>test</phase>
462+
<goals>
463+
<goal>test</goal>
464+
</goals>
465+
<configuration>
466+
<!-- drop the default excludedGroups -->
467+
<excludedGroups combine.self="override"/>
468+
<groups>org.apache.activemq.test.annotations.ParallelTest</groups>
469+
<forkCount>2C</forkCount>
470+
<reuseForks>false</reuseForks>
471+
<enableProcessChecker>all</enableProcessChecker>
472+
<forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds> <!-- max time tests may run -->
473+
<forkedProcessExitTimeoutInSeconds>30</forkedProcessExitTimeoutInSeconds> <!-- max time JVM may hang after tests -->
474+
<failIfNoTests>false</failIfNoTests>
475+
<systemPropertyVariables>
476+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/parallel-tests-${surefire.forkNumber}/</org.apache.activemq.default.directory.prefix>
477+
<!-- when running tests in parallel in the CI (quite slow) we need to bump the wireformat negotiation timeout (5s by default) -->
478+
<org.apache.activemq.transport.wireFormatNegotiationTimeout>30000</org.apache.activemq.transport.wireFormatNegotiationTimeout>
479+
</systemPropertyVariables>
480+
<excludes combine.children="append"/>
481+
</configuration>
482+
</execution>
483+
</executions>
484+
<dependencies>
485+
<dependency>
486+
<groupId>org.apache.maven.surefire</groupId>
487+
<artifactId>surefire-junit47</artifactId>
488+
<version>${surefire.version}</version>
489+
</dependency>
490+
<dependency>
491+
<groupId>me.fabriciorby</groupId>
492+
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
493+
<version>1.5.1</version>
494+
</dependency>
495+
</dependencies>
432496
</plugin>
497+
433498
<plugin>
434499
<groupId>org.apache.maven.plugins</groupId>
435500
<artifactId>maven-clean-plugin</artifactId>

activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@
3030
import org.apache.activemq.util.IdGenerator;
3131
import org.slf4j.Logger;
3232
import org.slf4j.LoggerFactory;
33+
import org.apache.activemq.test.annotations.ParallelTest;
34+
import org.junit.experimental.categories.Category;
3335

3436
/**
3537
* ActiveMQMessageAuditTest
3638
*
3739
*
3840
*/
41+
@Category(ParallelTest.class)
3942
public class ActiveMQMessageAuditTest extends TestCase {
4043

4144
static final Logger LOG = LoggerFactory.getLogger(ActiveMQMessageAuditTest.class);

activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXAConnectionTxInterruptTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@
5050

5151

5252
import static org.junit.Assert.*;
53+
import org.apache.activemq.test.annotations.ParallelTest;
54+
import org.junit.experimental.categories.Category;
5355

56+
@Category(ParallelTest.class)
5457
public class ActiveMQXAConnectionTxInterruptTest {
5558
private static final Logger LOG = LoggerFactory.getLogger(ActiveMQXAConnectionTxInterruptTest.class);
5659
long txGenerator = System.currentTimeMillis();

activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXASslConnectionFactoryTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
*/
1717
package org.apache.activemq;
1818

19+
import org.apache.activemq.test.annotations.ParallelTest;
20+
import org.junit.experimental.categories.Category;
21+
22+
@Category(ParallelTest.class)
1923
public class ActiveMQXASslConnectionFactoryTest extends ActiveMQSslConnectionFactoryTest {
2024

2125
@Override

activemq-unit-tests/src/test/java/org/apache/activemq/ActiveMQXASslConnectionFactoryVmTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
package org.apache.activemq;
1818

1919
import java.net.URI;
20+
import org.apache.activemq.test.annotations.ParallelTest;
21+
import org.junit.experimental.categories.Category;
2022

2123
/**
2224
* Test the against the VM transport
2325
*/
26+
@Category(ParallelTest.class)
2427
public class ActiveMQXASslConnectionFactoryVmTest extends ActiveMQXAConnectionFactoryTest {
2528

2629
@Override

activemq-unit-tests/src/test/java/org/apache/activemq/BrokerDurableRejectedTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
import org.apache.activemq.broker.BrokerRegistry;
2525
import org.apache.activemq.transport.stomp.Stomp;
2626
import org.apache.activemq.transport.stomp.StompConnection;
27+
import org.apache.activemq.test.annotations.ParallelTest;
28+
import org.junit.experimental.categories.Category;
2729

30+
@Category(ParallelTest.class)
2831
public class BrokerDurableRejectedTest extends TestSupport {
2932

3033
protected Connection connection;

activemq-unit-tests/src/test/java/org/apache/activemq/ClientTestSupport.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@
4242
import org.apache.activemq.command.RemoveInfo;
4343
import org.apache.activemq.command.SessionInfo;
4444
import org.apache.activemq.transport.TransportFactory;
45+
import org.apache.activemq.test.annotations.ParallelTest;
46+
import org.junit.experimental.categories.Category;
4547

48+
@Category(ParallelTest.class)
4649
public class ClientTestSupport extends TestCase {
4750

4851
protected BrokerService broker;

activemq-unit-tests/src/test/java/org/apache/activemq/ConnectionCleanupTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@
2020
import jakarta.jms.Session;
2121

2222
import junit.framework.TestCase;
23+
import org.apache.activemq.test.annotations.ParallelTest;
24+
import org.junit.experimental.categories.Category;
2325

2426
/**
2527
*
2628
*/
29+
@Category(ParallelTest.class)
2730
public class ConnectionCleanupTest extends TestCase {
2831

2932
private ActiveMQConnection connection;

activemq-unit-tests/src/test/java/org/apache/activemq/ConnectionCloseMultipleTimesConcurrentTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@
2424
import jakarta.jms.Session;
2525

2626
import junit.framework.TestCase;
27+
import org.apache.activemq.test.annotations.ParallelTest;
28+
import org.junit.experimental.categories.Category;
2729

2830
/**
2931
*
3032
*/
33+
@Category(ParallelTest.class)
3134
public class ConnectionCloseMultipleTimesConcurrentTest extends TestCase {
3235

3336
private ActiveMQConnection connection;

0 commit comments

Comments
 (0)