From 1a1a62b7446b47a3a115b48dfac1879a556917eb Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 24 Jan 2018 21:34:11 +0000 Subject: [PATCH] Protect tests against Cassandra startup failures On CI, Cassandra running inside the Docker container sometimes fails to start or the start times out. This has nothing to do with Boot so we attempt to protect our tests from the flakiness of the container by allowing 3 startup attempts. --- .../boot/testsupport/testcontainers/CassandraContainer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/testcontainers/CassandraContainer.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/testcontainers/CassandraContainer.java index d54581299b..ecee517926 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/testcontainers/CassandraContainer.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/testcontainers/CassandraContainer.java @@ -37,8 +37,8 @@ public class CassandraContainer extends Container { private static final int PORT = 9042; public CassandraContainer() { - super("cassandra:3.11.1", PORT, - (container) -> container.waitingFor(new WaitStrategy())); + super("cassandra:3.11.1", PORT, (container) -> container + .waitingFor(new WaitStrategy()).withStartupAttempts(3)); } private static class WaitStrategy extends HostPortWaitStrategy {