Skip to content

Commit f25bc52

Browse files
authored
AMQ-8525: Execute tests in parallel when possible (#1540)
1 parent 1d4e83b commit f25bc52

24 files changed

+153
-8
lines changed

activemq-stomp/pom.xml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
<artifactId>activemq-stomp</artifactId>
2929
<packaging>jar</packaging>
3030
<name>ActiveMQ :: STOMP Protocol</name>
31+
32+
<properties>
33+
<surefire.version>3.5.3</surefire.version>
34+
</properties>
35+
3136
<description>The ActiveMQ STOMP Protocol Implementation</description>
3237

3338
<dependencies>
@@ -125,23 +130,72 @@
125130

126131
<plugins>
127132
<plugin>
133+
<groupId>org.apache.maven.plugins</groupId>
128134
<artifactId>maven-surefire-plugin</artifactId>
135+
<version>${surefire.version}</version>
129136
<configuration>
130-
<forkCount>1</forkCount>
131-
<reuseForks>false</reuseForks>
132137
<argLine>${surefire.argLine}</argLine>
133138
<runOrder>alphabetical</runOrder>
139+
<reportFormat>plain</reportFormat>
134140
<failIfNoTests>false</failIfNoTests>
135-
<systemPropertyVariables>
136-
<org.apache.activemq.default.directory.prefix>target</org.apache.activemq.default.directory.prefix>
137-
</systemPropertyVariables>
141+
<excludedGroups>org.apache.activemq.transport.stomp.ParallelTest</excludedGroups>
142+
<systemPropertyVariables>
143+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/</org.apache.activemq.default.directory.prefix>
144+
</systemPropertyVariables>
145+
<consoleOutputReporter>
146+
<disable>true</disable>
147+
</consoleOutputReporter>
148+
<statelessTestsetInfoReporter
149+
implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
150+
<printStacktraceOnError>true</printStacktraceOnError>
151+
<printStacktraceOnFailure>true</printStacktraceOnFailure>
152+
<printStdoutOnError>true</printStdoutOnError>
153+
<printStdoutOnFailure>true</printStdoutOnFailure>
154+
<printStderrOnError>true</printStderrOnError>
155+
<printStderrOnFailure>true</printStderrOnFailure>
156+
</statelessTestsetInfoReporter>
138157
<includes>
139158
<include>**/*Test.*</include>
140159
</includes>
141160
<excludes>
142-
<exclude>**/StompNIOSSLLoadTest.java</exclude>
161+
<exclude>**/*LoadTest.java</exclude>
143162
</excludes>
144163
</configuration>
164+
<executions>
165+
<execution>
166+
<id>parallel</id>
167+
<phase>test</phase>
168+
<goals>
169+
<goal>test</goal>
170+
</goals>
171+
<configuration>
172+
<!-- drop the default excludedGroups -->
173+
<excludedGroups combine.self="override"/>
174+
<groups>org.apache.activemq.transport.stomp.ParallelTest</groups>
175+
<forkCount>2C</forkCount>
176+
<reuseForks>false</reuseForks>
177+
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
178+
<failIfNoTests>false</failIfNoTests>
179+
<systemPropertyVariables>
180+
<org.apache.activemq.default.directory.prefix>${project.build.directory}/parallel-tests-${surefire.forkNumber}/</org.apache.activemq.default.directory.prefix>
181+
<!-- when running tests in parallel in the CI (quite slow) we need to bump the wireformat negotiation timeout (5s by default) -->
182+
<org.apache.activemq.transport.wireFormatNegotiationTimeout>30000</org.apache.activemq.transport.wireFormatNegotiationTimeout>
183+
</systemPropertyVariables>
184+
</configuration>
185+
</execution>
186+
</executions>
187+
<dependencies>
188+
<dependency>
189+
<groupId>org.apache.maven.surefire</groupId>
190+
<artifactId>surefire-junit47</artifactId>
191+
<version>${surefire.version}</version>
192+
</dependency>
193+
<dependency>
194+
<groupId>me.fabriciorby</groupId>
195+
<artifactId>maven-surefire-junit5-tree-reporter</artifactId>
196+
<version>1.5.1</version>
197+
</dependency>
198+
</dependencies>
145199
</plugin>
146200
</plugins>
147201
</build>

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/ConnectTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
import org.junit.After;
3535
import org.junit.Before;
3636
import org.junit.Test;
37+
import org.junit.experimental.categories.Category;
3738
import org.slf4j.Logger;
3839
import org.slf4j.LoggerFactory;
3940

4041
// https://issues.apache.org/jira/browse/AMQ-3393
42+
@Category(ParallelTest.class)
4143
public class ConnectTest {
4244

4345
private static final Logger LOG = LoggerFactory.getLogger(ConnectTest.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/LegacyFrameTranslatorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626
import org.apache.activemq.command.ActiveMQDestination;
2727
import org.junit.Before;
2828
import org.junit.Test;
29+
import org.junit.experimental.categories.Category;
2930
import org.mockito.Mockito;
3031
import org.mockito.invocation.InvocationOnMock;
3132
import org.mockito.stubbing.Answer;
3233

3334
/**
3435
* Tests for conversion capabilities of LegacyFrameTranslator
3536
*/
37+
@Category(ParallelTest.class)
3638
public class LegacyFrameTranslatorTest {
3739

3840
private ProtocolConverter converter;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.activemq.transport.stomp;
18+
19+
20+
/**
21+
* Marker interface used with {@code @Category(ParallelTest.class)} to opt a
22+
* test class or method into the {@code all-parallel} Maven profile. Only tests
23+
* explicitly tagged with this category execute when the profile is enabled,
24+
* which allows a gradual migration toward full parallelism.
25+
*/
26+
public interface ParallelTest {
27+
}

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040

4141
import static org.junit.Assert.*;
4242

43+
import org.junit.experimental.categories.Category;
44+
45+
@Category(ParallelTest.class)
4346
public class Stomp11Test extends StompTestSupport {
4447

4548
private static final Logger LOG = LoggerFactory.getLogger(Stomp11Test.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp12Test.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import org.slf4j.Logger;
3535
import org.slf4j.LoggerFactory;
3636

37+
import org.junit.experimental.categories.Category;
38+
39+
@Category(ParallelTest.class)
3740
public class Stomp12Test extends StompTestSupport {
3841

3942
private static final Logger LOG = LoggerFactory.getLogger(Stomp12Test.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
import org.slf4j.Logger;
4646
import org.slf4j.LoggerFactory;
4747

48+
import org.junit.experimental.categories.Category;
49+
50+
@Category(ParallelTest.class)
4851
public class StompAdvisoryTest extends StompTestSupport {
4952
static final String STATS_DESTINATION_PREFIX = "ActiveMQ.Statistics.Destination";
5053

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompCompositeDestinationTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@
3939
import org.slf4j.Logger;
4040
import org.slf4j.LoggerFactory;
4141

42+
import org.junit.experimental.categories.Category;
43+
4244
/**
4345
* Tests for support of composite destination support over STOMP
4446
*/
47+
@Category(ParallelTest.class)
4548
public class StompCompositeDestinationTest extends StompTestSupport {
4649

4750
private static final Logger LOG = LoggerFactory.getLogger(StompCompositeDestinationTest.class);

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompConnectTimeoutTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@
3434
import org.slf4j.Logger;
3535
import org.slf4j.LoggerFactory;
3636

37+
import org.junit.experimental.categories.Category;
38+
3739
/**
3840
* Test that connection attempts that don't send the connect performative
3941
* get cleaned up by the inactivity monitor.
4042
*/
43+
@Category(ParallelTest.class)
4144
@RunWith(Parameterized.class)
4245
public class StompConnectTimeoutTest extends StompTestSupport {
4346

activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompEmptyDestinationTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
*/
1717
package org.apache.activemq.transport.stomp;
1818
import org.junit.Test;
19+
import org.junit.experimental.categories.Category;
1920
import org.slf4j.Logger;
2021
import org.slf4j.LoggerFactory;
2122
import static org.junit.Assert.assertEquals;
2223
import static org.junit.Assert.assertTrue;
2324

24-
public class StompEmptyDestinationTest extends StompTestSupport{
25+
@Category(ParallelTest.class)
26+
public class StompEmptyDestinationTest extends StompTestSupport{
2527
private static final Logger LOG = LoggerFactory.getLogger(StompEmptyDestinationTest.class);
2628

2729
@Test(timeout = 60000)

0 commit comments

Comments
 (0)