Increase timeouts for spring-rabbitmq-client tests
This commit is contained in:
@@ -56,13 +56,13 @@ public class RabbitAmqpAdminTests extends RabbitAmqpTestBase {
|
||||
template.convertAndSend("e2", "k2", "test3"),
|
||||
template.convertAndSend("e3", "k3", "test4"),
|
||||
template.convertAndSend("e4", "k4", "test5"));
|
||||
assertThat(publishFutures).succeedsWithin(Duration.ofSeconds(10));
|
||||
assertThat(publishFutures).succeedsWithin(Duration.ofSeconds(20));
|
||||
|
||||
assertThat(template.receiveAndConvert("q1")).succeedsWithin(Duration.ofSeconds(10)).isEqualTo("test1");
|
||||
assertThat(template.receiveAndConvert("q2")).succeedsWithin(Duration.ofSeconds(10)).isEqualTo("test2");
|
||||
assertThat(template.receiveAndConvert("q2")).succeedsWithin(Duration.ofSeconds(10)).isEqualTo("test3");
|
||||
assertThat(template.receiveAndConvert("q3")).succeedsWithin(Duration.ofSeconds(10)).isEqualTo("test4");
|
||||
assertThat(template.receiveAndConvert("q4")).succeedsWithin(Duration.ofSeconds(10)).isEqualTo("test5");
|
||||
assertThat(template.receiveAndConvert("q1")).succeedsWithin(Duration.ofSeconds(20)).isEqualTo("test1");
|
||||
assertThat(template.receiveAndConvert("q2")).succeedsWithin(Duration.ofSeconds(20)).isEqualTo("test2");
|
||||
assertThat(template.receiveAndConvert("q2")).succeedsWithin(Duration.ofSeconds(20)).isEqualTo("test3");
|
||||
assertThat(template.receiveAndConvert("q3")).succeedsWithin(Duration.ofSeconds(20)).isEqualTo("test4");
|
||||
assertThat(template.receiveAndConvert("q4")).succeedsWithin(Duration.ofSeconds(20)).isEqualTo("test5");
|
||||
|
||||
assertThat(declarables.getDeclarablesByType(Queue.class))
|
||||
.hasSize(1)
|
||||
|
||||
@@ -84,10 +84,10 @@ public class RabbitAmqpTemplateTests extends RabbitAmqpTestBase {
|
||||
this.rabbitAmqpTemplate.setRoutingKey("k1");
|
||||
|
||||
assertThat(this.rabbitAmqpTemplate.convertAndSend("test1"))
|
||||
.succeedsWithin(Duration.ofSeconds(10));
|
||||
.succeedsWithin(Duration.ofSeconds(20));
|
||||
|
||||
assertThat(this.rabbitAmqpTemplate.receiveAndConvert("q1"))
|
||||
.succeedsWithin(Duration.ofSeconds(10))
|
||||
.succeedsWithin(Duration.ofSeconds(20))
|
||||
.isEqualTo("test1");
|
||||
}
|
||||
|
||||
@@ -97,10 +97,10 @@ public class RabbitAmqpTemplateTests extends RabbitAmqpTestBase {
|
||||
this.rabbitAmqpTemplate.setReceiveQueue("q1");
|
||||
|
||||
assertThat(this.rabbitAmqpTemplate.convertAndSend("test2"))
|
||||
.succeedsWithin(Duration.ofSeconds(10));
|
||||
.succeedsWithin(Duration.ofSeconds(20));
|
||||
|
||||
assertThat(this.rabbitAmqpTemplate.receiveAndConvert())
|
||||
.succeedsWithin(Duration.ofSeconds(10))
|
||||
.succeedsWithin(Duration.ofSeconds(20))
|
||||
.isEqualTo("test2");
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class RabbitAmqpTemplateTests extends RabbitAmqpTestBase {
|
||||
return testReply;
|
||||
});
|
||||
|
||||
assertThat(rpcServerResult).succeedsWithin(Duration.ofSeconds(10)).isEqualTo(true);
|
||||
assertThat(rpcClientResult).succeedsWithin(Duration.ofSeconds(10)).isEqualTo(testReply);
|
||||
assertThat(rpcServerResult).succeedsWithin(Duration.ofSeconds(20)).isEqualTo(true);
|
||||
assertThat(rpcClientResult).succeedsWithin(Duration.ofSeconds(20)).isEqualTo(testReply);
|
||||
assertThat(receivedRequest.get()).isEqualTo(testRequest);
|
||||
|
||||
this.template.send("q1",
|
||||
@@ -131,7 +131,7 @@ public class RabbitAmqpTemplateTests extends RabbitAmqpTestBase {
|
||||
|
||||
rpcServerResult = this.rabbitAmqpTemplate.<String, String>receiveAndReply("q1", payload -> "reply-attempt");
|
||||
|
||||
assertThat(rpcServerResult).failsWithin(Duration.ofSeconds(10))
|
||||
assertThat(rpcServerResult).failsWithin(Duration.ofSeconds(20))
|
||||
.withThrowableOfType(ExecutionException.class)
|
||||
.withCauseInstanceOf(AmqpIllegalStateException.class)
|
||||
.withRootCauseInstanceOf(IllegalArgumentException.class)
|
||||
@@ -141,7 +141,7 @@ public class RabbitAmqpTemplateTests extends RabbitAmqpTestBase {
|
||||
rpcClientResult = this.template.convertSendAndReceive("q1", testRequest);
|
||||
rpcServerResult = this.rabbitAmqpTemplate.<String, String>receiveAndReply("q1", payload -> null);
|
||||
|
||||
assertThat(rpcServerResult).succeedsWithin(Duration.ofSeconds(10)).isEqualTo(false);
|
||||
assertThat(rpcServerResult).succeedsWithin(Duration.ofSeconds(20)).isEqualTo(false);
|
||||
assertThat(rpcClientResult).failsWithin(Duration.ofSeconds(2))
|
||||
.withThrowableThat()
|
||||
.isInstanceOf(TimeoutException.class);
|
||||
@@ -149,17 +149,17 @@ public class RabbitAmqpTemplateTests extends RabbitAmqpTestBase {
|
||||
this.template.convertSendAndReceive("q1", new byte[0]);
|
||||
|
||||
rpcServerResult = this.rabbitAmqpTemplate.<String, String>receiveAndReply("q1", payload -> payload);
|
||||
assertThat(rpcServerResult).failsWithin(Duration.ofSeconds(10))
|
||||
assertThat(rpcServerResult).failsWithin(Duration.ofSeconds(20))
|
||||
.withThrowableOfType(ExecutionException.class)
|
||||
.withCauseInstanceOf(AmqpIllegalStateException.class)
|
||||
.withRootCauseInstanceOf(ClassCastException.class)
|
||||
.withMessageContaining("Failed to process RPC request: (Body:'[B")
|
||||
.withStackTraceContaining("class [B cannot be cast to class java.lang.String");
|
||||
|
||||
assertThat(this.template.receiveAndConvert("dlq1")).succeedsWithin(10, TimeUnit.SECONDS)
|
||||
assertThat(this.template.receiveAndConvert("dlq1")).succeedsWithin(20, TimeUnit.SECONDS)
|
||||
.isEqualTo("non-rpc-request");
|
||||
|
||||
assertThat(this.template.receiveAndConvert("dlq1")).succeedsWithin(10, TimeUnit.SECONDS)
|
||||
assertThat(this.template.receiveAndConvert("dlq1")).succeedsWithin(20, TimeUnit.SECONDS)
|
||||
.isEqualTo(new byte[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,14 +92,14 @@ class RabbitAmqpListenerTests extends RabbitAmqpTestBase {
|
||||
this.template.convertAndSend((random.nextInt(2) == 0 ? "q1" : "q2"), testData);
|
||||
}
|
||||
|
||||
assertThat(this.config.consumeIsDone.await(10, TimeUnit.SECONDS)).isTrue();
|
||||
assertThat(this.config.consumeIsDone.await(20, TimeUnit.SECONDS)).isTrue();
|
||||
|
||||
synchronized (this.config.received) {
|
||||
assertThat(this.config.received).containsAll(testDataList);
|
||||
}
|
||||
|
||||
assertThat(this.template.receive("dlq1")).succeedsWithin(10, TimeUnit.SECONDS);
|
||||
assertThat(this.template.receive("dlq1")).succeedsWithin(10, TimeUnit.SECONDS);
|
||||
assertThat(this.template.receive("dlq1")).succeedsWithin(20, TimeUnit.SECONDS);
|
||||
assertThat(this.template.receive("dlq1")).succeedsWithin(20, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -112,7 +112,7 @@ class RabbitAmqpListenerTests extends RabbitAmqpTestBase {
|
||||
this.template.convertAndSend("q3", testData);
|
||||
}
|
||||
|
||||
assertThat(this.config.batchReceived).succeedsWithin(10, TimeUnit.SECONDS)
|
||||
assertThat(this.config.batchReceived).succeedsWithin(20, TimeUnit.SECONDS)
|
||||
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||
.hasSize(5)
|
||||
.containsAll(testDataList);
|
||||
@@ -141,7 +141,7 @@ class RabbitAmqpListenerTests extends RabbitAmqpTestBase {
|
||||
this.template.convertAndSend("q3", testData);
|
||||
}
|
||||
|
||||
assertThat(this.config.batchReceived).succeedsWithin(10, TimeUnit.SECONDS)
|
||||
assertThat(this.config.batchReceived).succeedsWithin(20, TimeUnit.SECONDS)
|
||||
.asInstanceOf(InstanceOfAssertFactories.LIST)
|
||||
.hasSize(10)
|
||||
.containsAll(testDataList);
|
||||
@@ -152,26 +152,26 @@ class RabbitAmqpListenerTests extends RabbitAmqpTestBase {
|
||||
@Test
|
||||
void verifyBasicRequestReply() {
|
||||
CompletableFuture<String> replyFuture = this.template.convertSendAndReceive("requestQueue", "test data");
|
||||
assertThat(replyFuture).succeedsWithin(10, TimeUnit.SECONDS).isEqualTo("TEST DATA");
|
||||
assertThat(replyFuture).succeedsWithin(20, TimeUnit.SECONDS).isEqualTo("TEST DATA");
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyFutureReturnRequestReply() {
|
||||
CompletableFuture<String> replyFuture = this.template.convertSendAndReceive("requestQueue2", "TEST DATA2");
|
||||
assertThat(replyFuture).succeedsWithin(10, TimeUnit.SECONDS).isEqualTo("test data2");
|
||||
assertThat(replyFuture).succeedsWithin(20, TimeUnit.SECONDS).isEqualTo("test data2");
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyMonoReturnRequestReply() {
|
||||
CompletableFuture<String> replyFuture = this.template.convertSendAndReceive("requestQueue3", "test data3");
|
||||
assertThat(replyFuture).succeedsWithin(10, TimeUnit.SECONDS).isEqualTo("Mono test data3");
|
||||
assertThat(replyFuture).succeedsWithin(20, TimeUnit.SECONDS).isEqualTo("Mono test data3");
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyReplyOnAnotherQueue() {
|
||||
this.template.convertAndSend("requestQueue4", "test data4");
|
||||
CompletableFuture<Object> replyFuture = this.template.receiveAndConvert("q4");
|
||||
assertThat(replyFuture).succeedsWithin(10, TimeUnit.SECONDS)
|
||||
assertThat(replyFuture).succeedsWithin(20, TimeUnit.SECONDS)
|
||||
.isEqualTo("Reply for 'test data4' via 'e1' and 'k4'");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user