Upgrade to Testcontainers 1.15.0

Closes gh-24103
pull/24264/head
Stephane Nicoll 4 years ago
parent 23ad2b4156
commit 9e901b6e07

@ -85,7 +85,7 @@ class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
extends CassandraContainer<PasswordAuthenticatorCassandraContainer> {
PasswordAuthenticatorCassandraContainer() {
super(DockerImageNames.cassandra().toString());
super(DockerImageNames.cassandra());
}
@Override

@ -47,7 +47,7 @@ class CouchbaseAutoConfigurationIntegrationTests {
private static final String BUCKET_NAME = "cbbucket";
@Container
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase().toString())
static final CouchbaseContainer couchbase = new CouchbaseContainer(DockerImageNames.couchbase())
.withCredentials("spring", "password").withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10))
.withBucket(new BucketDefinition(BUCKET_NAME).withPrimaryIndex(false));

@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CassandraDataAutoConfigurationIntegrationTests {
@Container
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra().toString())
static final CassandraContainer<?> cassandra = new CassandraContainer<>(DockerImageNames.cassandra())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

@ -49,9 +49,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class ElasticsearchRepositoriesAutoConfigurationTests {
@Container
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ElasticsearchRestClientAutoConfiguration.class,

@ -48,9 +48,8 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
@Container
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ReactiveElasticsearchRestClientAutoConfiguration.class,

@ -48,9 +48,8 @@ import static org.mockito.Mockito.mock;
public class ReactiveElasticsearchRestClientAutoConfigurationTests {
@Container
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ReactiveElasticsearchRestClientAutoConfiguration.class));

@ -60,9 +60,8 @@ import static org.mockito.Mockito.mock;
class ElasticsearchRestClientAutoConfigurationTests {
@Container
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(
DockerImageNames.elasticsearch().toString()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(10));
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer(DockerImageNames.elasticsearch())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ElasticsearchRestClientAutoConfiguration.class));

@ -47,8 +47,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class SessionAutoConfigurationMongoTests extends AbstractSessionAutoConfigurationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,

@ -161,7 +161,7 @@ bom {
]
}
}
library("Testcontainers", "1.14.3") {
library("Testcontainers", "1.15.0") {
group("org.testcontainers") {
imports = [
"testcontainers-bom"

@ -44,8 +44,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class DataMongoTestIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private MongoTemplate mongoTemplate;

@ -41,8 +41,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataMongoTestReactiveIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private ReactiveMongoTemplate mongoTemplate;

@ -42,8 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataMongoTestWithIncludeFilterIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private ExampleService service;

@ -48,8 +48,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class TransactionalDataMongoTestIntegrationTests {
@Container
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo().toString())
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(5));
static final MongoDBContainer mongoDB = new MongoDBContainer(DockerImageNames.mongo()).withStartupAttempts(5)
.withStartupTimeout(Duration.ofMinutes(5));
@Autowired
private ExampleRepository exampleRepository;

@ -46,8 +46,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
class DataNeo4jTestIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@Autowired
private Session session;

@ -42,8 +42,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataNeo4jTestPropertiesIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@Autowired
private Environment environment;

@ -43,8 +43,8 @@ import static org.assertj.core.api.Assertions.assertThat;
class DataNeo4jTestWithIncludeFilterIntegrationTests {
@Container
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j().toString())
.withoutAuthentication().withStartupTimeout(Duration.ofMinutes(10));
static final Neo4jContainer<?> neo4j = new Neo4jContainer<>(DockerImageNames.neo4j()).withoutAuthentication()
.withStartupTimeout(Duration.ofMinutes(10));
@Autowired
private ExampleService service;

@ -46,7 +46,7 @@ public final class DockerImageNames {
* @return a docker image name for running cassandra
*/
public static DockerImageName cassandra() {
return new DockerImageName("cassandra", CASSANDRA_VERSION);
return DockerImageName.parse("cassandra").withTag(CASSANDRA_VERSION);
}
/**
@ -54,7 +54,7 @@ public final class DockerImageNames {
* @return a docker image name for running cassandra
*/
public static DockerImageName couchbase() {
return new DockerImageName("couchbase/server", COUCHBASE_VERSION);
return DockerImageName.parse("couchbase/server").withTag(COUCHBASE_VERSION);
}
/**
@ -64,7 +64,7 @@ public final class DockerImageNames {
*/
public static DockerImageName elasticsearch() {
String version = org.elasticsearch.Version.CURRENT.toString();
return new DockerImageName("docker.elastic.co/elasticsearch/elasticsearch", version);
return DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch").withTag(version);
}
/**
@ -72,7 +72,7 @@ public final class DockerImageNames {
* @return a docker image name for running mongo
*/
public static DockerImageName mongo() {
return new DockerImageName("mongo", MONGO_VERSION);
return DockerImageName.parse("mongo").withTag(MONGO_VERSION);
}
/**
@ -80,7 +80,7 @@ public final class DockerImageNames {
* @return a docker image name for running neo4j
*/
public static DockerImageName neo4j() {
return new DockerImageName("neo4j", NEO4J_VERSION);
return DockerImageName.parse("neo4j").withTag(NEO4J_VERSION);
}
/**
@ -88,7 +88,7 @@ public final class DockerImageNames {
* @return a docker image name for running postgresql
*/
public static DockerImageName postgresql() {
return new DockerImageName("postgres", POSTGRESQL_VERSION);
return DockerImageName.parse("postgres").withTag(POSTGRESQL_VERSION);
}
/**
@ -96,7 +96,7 @@ public final class DockerImageNames {
* @return a docker image name for running redis
*/
public static DockerImageName redis() {
return new DockerImageName("redis", REDIS_VERSION);
return DockerImageName.parse("redis").withTag(REDIS_VERSION);
}
}

@ -28,7 +28,7 @@ import org.testcontainers.containers.GenericContainer;
public class RedisContainer extends GenericContainer<RedisContainer> {
public RedisContainer() {
super(DockerImageNames.redis().toString());
super(DockerImageNames.redis());
addExposedPorts(6379);
}

@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CityRepositoryTests {
@Container
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql().toString())
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql())
.withDatabaseName("test_flyway");
@DynamicPropertySource

@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class CityRepositoryTests {
@Container
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql().toString())
static PostgreSQLContainer<?> postgresql = new PostgreSQLContainer<>(DockerImageNames.postgresql())
.withDatabaseName("test_liquibase");
@DynamicPropertySource

Loading…
Cancel
Save