Skip to content

Commit 6153ebc

Browse files
committed
[AMQ-8525] run parallel-friendly tests into seperate forks in parallel
1 parent 359d953 commit 6153ebc

27 files changed

+149
-15
lines changed

activemq-mqtt/pom.xml

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<artifactId>activemq-mqtt</artifactId>
2929
<packaging>jar</packaging>
3030
<name>ActiveMQ :: MQTT Protocol</name>
31+
3132
<description>The ActiveMQ MQTT Protocol Implementation</description>
3233

3334
<dependencies>
@@ -201,21 +202,56 @@
201202
<plugin>
202203
<artifactId>maven-surefire-plugin</artifactId>
203204
<configuration>
204-
<forkCount>1</forkCount>
205-
<reuseForks>false</reuseForks>
206205
<argLine>${surefire.argLine}</argLine>
207206
<runOrder>alphabetical</runOrder>
208-
<systemPropertyValues>
209-
<org.apache.activemq.default.directory.prefix>target</org.apache.activemq.default.directory.prefix>
210-
</systemPropertyValues>
211-
<!-- includes>
212-
<include>**/*Test.*</include>
213-
</includes -->
214-
<excludes>
215-
<exclude>**/PahoMQTNioTTest.java</exclude>
216-
</excludes>
207+
<reportFormat>plain</reportFormat>
208+
<excludedGroups>org.apache.activemq.transport.mqtt.ParallelTest</excludedGroups>
209+
<systemPropertyVariables>
210+
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
211+
<org.apache.activemq.AutoFailTestSupport.disableSystemExit>true</org.apache.activemq.AutoFailTestSupport.disableSystemExit>
212+
<org.apache.activemq.broker.jmx.createConnector>false</org.apache.activemq.broker.jmx.createConnector>
213+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/</org.apache.activemq.default.directory.prefix>
214+
</systemPropertyVariables>
215+
<consoleOutputReporter>
216+
<disable>true</disable>
217+
</consoleOutputReporter>
218+
<statelessTestsetInfoReporter
219+
implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
220+
<printStacktraceOnError>true</printStacktraceOnError>
221+
<printStacktraceOnFailure>true</printStacktraceOnFailure>
222+
<printStdoutOnError>true</printStdoutOnError>
223+
<printStdoutOnFailure>true</printStdoutOnFailure>
224+
<printStderrOnError>true</printStderrOnError>
225+
<printStderrOnFailure>true</printStderrOnFailure>
226+
</statelessTestsetInfoReporter>
227+
<excludes>
228+
<exclude>**/PahoMQTNioTTest.java</exclude>
229+
</excludes>
217230
</configuration>
231+
<executions>
232+
<execution>
233+
<id>parallel</id>
234+
<phase>test</phase>
235+
<goals>
236+
<goal>test</goal>
237+
</goals>
238+
<configuration>
239+
<!-- drop the default excludedGroups -->
240+
<excludedGroups combine.self="override"/>
241+
<groups>org.apache.activemq.transport.mqtt.ParallelTest</groups>
242+
<forkCount>2C</forkCount>
243+
<reuseForks>false</reuseForks>
244+
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
245+
<systemPropertyVariables>
246+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/parallel-tests-${surefire.forkNumber}/</org.apache.activemq.default.directory.prefix>
247+
<!-- when running MQTT tests in parallel in the CI (quite slow) we need to bump the wireformat negotiation timeout (5s by default) -->
248+
<org.apache.activemq.transport.wireFormatNegotiationTimeout>20000</org.apache.activemq.transport.wireFormatNegotiationTimeout>
249+
</systemPropertyVariables>
250+
</configuration>
251+
</execution>
252+
</executions>
218253
</plugin>
254+
219255
<plugin>
220256
<groupId>org.apache.activemq.protobuf</groupId>
221257
<artifactId>activemq-protobuf</artifactId>

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTAuthTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@
4747
import org.fusesource.mqtt.codec.CONNACK;
4848
import org.fusesource.mqtt.codec.MQTTFrame;
4949
import org.junit.Test;
50+
import org.junit.experimental.categories.Category;
5051
import org.junit.runner.RunWith;
5152
import org.junit.runners.Parameterized;
5253
import org.junit.runners.Parameterized.Parameters;
5354
import org.slf4j.Logger;
5455
import org.slf4j.LoggerFactory;
55-
5656
/**
5757
* Tests various use cases that require authentication or authorization over MQTT
5858
*/
59+
@Category(ParallelTest.class)
5960
@RunWith(Parameterized.class)
6061
public class MQTTAuthTest extends MQTTAuthTestSupport {
6162

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCodecTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@
4141
import org.fusesource.mqtt.codec.UNSUBSCRIBE;
4242
import org.junit.Before;
4343
import org.junit.Test;
44+
import org.junit.experimental.categories.Category;
4445
import org.slf4j.Logger;
4546
import org.slf4j.LoggerFactory;
4647

4748
/**
4849
* Tests the functionality of the MQTTCodec class.
4950
*/
51+
@Category(ParallelTest.class)
5052
public class MQTTCodecTest {
5153

5254
private static final Logger LOG = LoggerFactory.getLogger(MQTTCodecTest.class);

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTCompositeQueueRetainedTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@
4242
import org.apache.activemq.util.ByteSequence;
4343
import org.junit.Test;
4444

45+
import org.junit.experimental.categories.Category;
46+
4547
/**
4648
*
4749
*/
50+
@Category(ParallelTest.class)
4851
public class MQTTCompositeQueueRetainedTest extends MQTTTestSupport {
4952

5053
// configure composite topic

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTConnectTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.junit.After;
3636
import org.junit.Ignore;
3737
import org.junit.Test;
38+
import org.junit.experimental.categories.Category;
3839
import org.junit.runner.RunWith;
3940
import org.junit.runners.Parameterized;
4041
import org.junit.runners.Parameterized.Parameters;
@@ -45,6 +46,7 @@
4546
* Test that connection attempts that don't send a CONNECT frame will
4647
* get cleaned up by the inactivity monitor.
4748
*/
49+
@Category(ParallelTest.class)
4850
@RunWith(Parameterized.class)
4951
public class MQTTConnectTest extends MQTTTestSupport {
5052

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTMaxFrameSizeTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@
3131
import org.slf4j.Logger;
3232
import org.slf4j.LoggerFactory;
3333

34+
import org.junit.experimental.categories.Category;
3435
/**
3536
* Test that the maxFrameSize configuration value is applied across the transports.
3637
*/
38+
@Category(ParallelTest.class)
3739
@RunWith(Parameterized.class)
3840
public class MQTTMaxFrameSizeTest extends MQTTTestSupport {
3941

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNIOSSLTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
*/
1717
package org.apache.activemq.transport.mqtt;
1818

19+
import org.junit.experimental.categories.Category;
20+
1921
/**
2022
* Run the basic tests with the NIO Transport.
2123
*/
24+
@Category(ParallelTest.class)
2225
public class MQTTNIOSSLTest extends MQTTTest {
2326

2427
@Override

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNIOTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
*/
1717
package org.apache.activemq.transport.mqtt;
1818

19+
import org.junit.experimental.categories.Category;
20+
1921
/**
2022
* Run the basic tests with the NIO Transport.
2123
*/
24+
@Category(ParallelTest.class)
2225
public class MQTTNIOTest extends MQTTTest {
2326

2427
@Override

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTOverlapedSubscriptionsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
import org.junit.After;
3030
import org.junit.Before;
3131
import org.junit.Test;
32+
import org.junit.experimental.categories.Category;
3233

34+
@Category(ParallelTest.class)
3335
public class MQTTOverlapedSubscriptionsTest {
3436

3537
private BrokerService brokerService;

activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTPingReqTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@
5252
import org.slf4j.Logger;
5353
import org.slf4j.LoggerFactory;
5454

55+
import org.junit.experimental.categories.Category;
5556
/**
5657
* Test to show that a PINGRESP will only be sent for a PINGREQ
5758
* packet after a CONNECT packet has been received.
5859
*/
60+
@Category(ParallelTest.class)
5961
@RunWith(Parameterized.class)
6062
public class MQTTPingReqTest extends MQTTTestSupport {
6163

0 commit comments

Comments
 (0)