Skip to content

Commit f4eb5eb

Browse files
committed
Increase timeouts in DirectMessageListenerContainerMockTests
**Auto-cherry-pick to `4.0.x` & `3.2.x`**
1 parent 5c2b3ae commit f4eb5eb

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/DirectMessageListenerContainerMockTests.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ public void testAlwaysCancelAutoRecoverConsumer() throws Exception {
116116
container.afterPropertiesSet();
117117
container.start();
118118

119-
assertThat(latch1.await(10, TimeUnit.SECONDS)).isTrue();
119+
assertThat(latch1.await(30, TimeUnit.SECONDS)).isTrue();
120120
assertThat(qos.get()).isEqualTo(2);
121121
isOpen.set(false);
122-
assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue();
122+
assertThat(latch2.await(30, TimeUnit.SECONDS)).isTrue();
123123
container.stop();
124124
}
125125

@@ -183,7 +183,7 @@ else if (i.getArgument(0).equals(17L)) {
183183
container.afterPropertiesSet();
184184
container.start();
185185

186-
assertThat(latch1.await(10, TimeUnit.SECONDS)).isTrue();
186+
assertThat(latch1.await(30, TimeUnit.SECONDS)).isTrue();
187187
assertThat(qos.get()).isEqualTo(10);
188188
BasicProperties props = new BasicProperties();
189189
byte[] body = new byte[1];
@@ -193,7 +193,7 @@ else if (i.getArgument(0).equals(17L)) {
193193
Thread.sleep(200);
194194
consumer.get().handleDelivery("consumerTag", envelope(16), props, body);
195195
// should get 2 acks #10 and #16 (timeout)
196-
assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue();
196+
assertThat(latch2.await(30, TimeUnit.SECONDS)).isTrue();
197197
consumer.get().handleDelivery("consumerTag", envelope(17), props, body);
198198
verify(channel).basicAck(10L, true);
199199
verify(channel).basicAck(16L, true);
@@ -202,7 +202,7 @@ else if (i.getArgument(0).equals(17L)) {
202202
verify(channel).basicAck(17L, true);
203203
consumer.get().handleDelivery("consumerTag", envelope(18), props, body);
204204
consumer.get().handleDelivery("consumerTag", envelope(19), props, body);
205-
assertThat(latch4.await(10, TimeUnit.SECONDS)).isTrue();
205+
assertThat(latch4.await(30, TimeUnit.SECONDS)).isTrue();
206206
// pending acks before nack
207207
verify(channel).basicAck(18L, true);
208208
verify(channel).basicNack(19L, true, true);
@@ -214,7 +214,7 @@ else if (i.getArgument(0).equals(17L)) {
214214
return null;
215215
}).given(channel).basicCancel("consumerTag");
216216
Executors.newSingleThreadExecutor().execute(container::stop);
217-
assertThat(latch5.await(10, TimeUnit.SECONDS)).isTrue();
217+
assertThat(latch5.await(30, TimeUnit.SECONDS)).isTrue();
218218
// pending acks on stop
219219
verify(channel).basicAck(20L, true);
220220
}
@@ -266,13 +266,13 @@ public void testRemoveQueuesWhileNotConnected() throws Exception {
266266
container.afterPropertiesSet();
267267
container.start();
268268

269-
assertThat(latch1.await(10, TimeUnit.SECONDS)).isTrue();
269+
assertThat(latch1.await(30, TimeUnit.SECONDS)).isTrue();
270270
assertThat(qos.get()).isEqualTo(2);
271271
isOpen.set(false);
272272
container.removeQueueNames("test1");
273-
assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue();
273+
assertThat(latch2.await(30, TimeUnit.SECONDS)).isTrue();
274274
isOpen.set(true);
275-
assertThat(latch3.await(10, TimeUnit.SECONDS)).isTrue();
275+
assertThat(latch3.await(30, TimeUnit.SECONDS)).isTrue();
276276

277277
verify(channel, times(1)).basicConsume(eq("test1"), anyBoolean(), anyString(), anyBoolean(), anyBoolean(),
278278
anyMap(), any(Consumer.class));
@@ -320,9 +320,9 @@ public void testMonitorCancelsAfterBadAckEvenIfChannelReportsOpen() throws Excep
320320
container.afterPropertiesSet();
321321
container.start();
322322

323-
assertThat(latch1.await(10, TimeUnit.SECONDS)).isTrue();
323+
assertThat(latch1.await(30, TimeUnit.SECONDS)).isTrue();
324324
consumer.get().handleDelivery("consumerTag", envelope(1L), new BasicProperties(), new byte[1]);
325-
assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue();
325+
assertThat(latch2.await(30, TimeUnit.SECONDS)).isTrue();
326326
container.stop();
327327
}
328328

@@ -366,9 +366,9 @@ public void testMonitorCancelsAfterTargetChannelChanges() throws Exception {
366366
container.afterPropertiesSet();
367367
container.start();
368368

369-
assertThat(latch1.await(10, TimeUnit.SECONDS)).isTrue();
369+
assertThat(latch1.await(30, TimeUnit.SECONDS)).isTrue();
370370
consumer.get().handleDelivery("consumerTag", envelope(1L), new BasicProperties(), new byte[1]);
371-
assertThat(latch2.await(10, TimeUnit.SECONDS)).isTrue();
371+
assertThat(latch2.await(30, TimeUnit.SECONDS)).isTrue();
372372
container.stop();
373373
}
374374

0 commit comments

Comments
 (0)