Skip to content

Commit a639a48

Browse files
committed
test(MaxFrameSizeEnabled): increase timeouts to improve test reliability
1 parent 56a7815 commit a639a48

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

activemq-unit-tests/src/test/java/org/apache/activemq/transport/MaxFrameSizeEnabledTest.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public class MaxFrameSizeEnabledTest {
5555
private static final int CONNECTION_COUNT = 3;
5656
private static final int MESSAGE_ATTEMPTS = 3;
5757
private static final int BODY_SIZE = 20000; // large enough to trip 2k limit, compressible enough for 60k
58+
private static final long BROKER_START_TIMEOUT_MS = 30_000;
59+
private static final long BROKER_STOP_TIMEOUT_MS = 30_000;
60+
private static final int TEST_TIMEOUT_MS = 120_000;
5861

5962
private BrokerService broker;
6063
private final String transportType;
@@ -158,30 +161,32 @@ public void after() throws Exception {
158161
}
159162

160163
public BrokerService createBroker(String connectorName, String connectorString) throws Exception {
161-
BrokerService broker = new BrokerService();
164+
final BrokerService broker = new BrokerService();
162165
broker.setPersistent(false);
163166
broker.setUseJmx(false);
164-
TransportConnector connector = broker.addConnector(connectorString);
167+
final TransportConnector connector = broker.addConnector(connectorString);
165168
connector.setName(connectorName);
166169
broker.start();
167-
broker.waitUntilStarted();
170+
assertTrue("Broker should start within timeout",
171+
Wait.waitFor(broker::isStarted, BROKER_START_TIMEOUT_MS, 100));
168172
return broker;
169173
}
170174

171175
public void stopBroker(BrokerService broker) throws Exception {
172176
if (broker != null) {
173177
broker.stop();
174-
broker.waitUntilStopped();
178+
assertTrue("Broker should stop within timeout",
179+
Wait.waitFor(broker::isStopped, BROKER_STOP_TIMEOUT_MS, 100));
175180
}
176181
}
177182

178-
@Test
183+
@Test(timeout = TEST_TIMEOUT_MS)
179184
public void testMaxFrameSize() throws Exception {
180185
broker = createBroker(transportType, transportType + "://localhost:0?wireFormat.maxFrameSize=2048" + getServerParams());
181186
testMaxFrameSize(transportType, getClientUri(broker.getConnectorByName(transportType).getConnectUri().getPort()), false);
182187
}
183188

184-
@Test
189+
@Test(timeout = TEST_TIMEOUT_MS)
185190
public void testMaxFrameSizeCompression() throws Exception {
186191
// Test message body length is 99841 bytes. Compresses to ~ 48000
187192
broker = createBroker(transportType, transportType + "://localhost:0?wireFormat.maxFrameSize=60000" + getServerParams());

activemq-unit-tests/src/test/java/org/apache/activemq/transport/RestrictedThreadPoolInactivityTimeoutTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
public class RestrictedThreadPoolInactivityTimeoutTest extends JmsTestSupport {
3737
private static final Logger LOG = LoggerFactory.getLogger(RestrictedThreadPoolInactivityTimeoutTest.class);
38+
private static final int TEST_TIMEOUT_MS = 120_000;
3839

3940
public String brokerTransportScheme = "tcp";
4041
public Boolean rejectWork = Boolean.FALSE;
@@ -86,6 +87,7 @@ public void initCombosForTestThreadsInvolvedInXInactivityTimeouts() {
8687
addCombinationValues("rejectWork", new Object[] {Boolean.TRUE, Boolean.FALSE});
8788
}
8889

90+
@org.junit.Test(timeout = TEST_TIMEOUT_MS)
8991
public void testThreadsInvolvedInXInactivityTimeouts() throws Exception {
9092

9193
URI tcpBrokerUri = URISupport.removeQuery(broker.getTransportConnectors().get(0).getConnectUri());

0 commit comments

Comments
 (0)