mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Revert "Upgrade to Testcontainers 1.15.0"
This commit is contained in:
parent
5123eb0c74
commit
339c8d0a26
@ -28,6 +28,7 @@ import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.rnorth.ducttape.TimeoutException;
|
||||
import org.rnorth.ducttape.unreliables.Unreliables;
|
||||
import org.testcontainers.containers.CassandraContainer;
|
||||
import org.testcontainers.containers.ContainerLaunchException;
|
||||
import org.testcontainers.containers.wait.strategy.AbstractWaitStrategy;
|
||||
import org.testcontainers.images.builder.Transferable;
|
||||
@ -36,7 +37,6 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.CassandraContainer;
|
||||
import org.springframework.util.StreamUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -51,7 +51,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final CassandraContainer cassandra = new PasswordAuthenticatorCassandraContainer().withStartupAttempts(5)
|
||||
static final CassandraContainer<?> cassandra = new PasswordAuthenticatorCassandraContainer().withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10)).waitingFor(new CassandraWaitStrategy());
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
@ -80,7 +80,8 @@ class CassandraAutoConfigurationWithPasswordAuthenticationIntegrationTests {
|
||||
.hasMessageContaining("Authentication error"));
|
||||
}
|
||||
|
||||
static final class PasswordAuthenticatorCassandraContainer extends CassandraContainer {
|
||||
static final class PasswordAuthenticatorCassandraContainer
|
||||
extends CassandraContainer<PasswordAuthenticatorCassandraContainer> {
|
||||
|
||||
@Override
|
||||
protected void containerIsCreated(String containerId) {
|
||||
|
@ -21,6 +21,7 @@ import java.time.Duration;
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
import com.datastax.oss.driver.api.core.CqlSessionBuilder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.containers.CassandraContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
@ -30,7 +31,6 @@ import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.data.cassandra.city.City;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.CassandraContainer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.cassandra.config.SchemaAction;
|
||||
@ -48,7 +48,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class CassandraDataAutoConfigurationIntegrationTests {
|
||||
|
||||
@Container
|
||||
static final CassandraContainer cassandra = new CassandraContainer().withStartupAttempts(5)
|
||||
static final CassandraContainer<?> cassandra = new CassandraContainer<>().withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
|
@ -31,7 +31,6 @@ import org.springframework.boot.autoconfigure.data.elasticsearch.city.CityReposi
|
||||
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
|
||||
import org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.VersionOverridingElasticsearchContainer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||
|
@ -30,7 +30,6 @@ import org.springframework.boot.autoconfigure.data.elasticsearch.city.City;
|
||||
import org.springframework.boot.autoconfigure.data.elasticsearch.city.ReactiveCityRepository;
|
||||
import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.VersionOverridingElasticsearchContainer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchTemplate;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
|
||||
|
@ -30,7 +30,6 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.VersionOverridingElasticsearchContainer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.elasticsearch.client.ClientConfiguration;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.boot.testsupport.testcontainers;
|
||||
package org.springframework.boot.autoconfigure.data.elasticsearch;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
||||
@ -22,17 +22,16 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
||||
* Extension of {@link ElasticsearchContainer} to override default version.
|
||||
*
|
||||
* @author Scott Frederick
|
||||
* @since 2.3.6
|
||||
*/
|
||||
public class VersionOverridingElasticsearchContainer extends ElasticsearchContainer {
|
||||
|
||||
/**
|
||||
* Elasticsearch Docker base URL.
|
||||
* Elasticsearch Docker base URL
|
||||
*/
|
||||
private static final String ELASTICSEARCH_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch";
|
||||
|
||||
/**
|
||||
* Elasticsearch version.
|
||||
* Elasticsearch version
|
||||
*/
|
||||
protected static final String ELASTICSEARCH_VERSION = Version.CURRENT.toString();
|
||||
|
@ -42,7 +42,6 @@ import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.testcontainers.VersionOverridingElasticsearchContainer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@ -60,8 +59,8 @@ import static org.mockito.Mockito.mock;
|
||||
class ElasticsearchRestClientAutoConfigurationTests {
|
||||
|
||||
@Container
|
||||
static final ElasticsearchContainer elasticsearch = new VersionOverridingElasticsearchContainer()
|
||||
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10));
|
||||
static final ElasticsearchContainer elasticsearch = new ElasticsearchContainer().withStartupAttempts(5)
|
||||
.withStartupTimeout(Duration.ofMinutes(10));
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(ElasticsearchRestClientAutoConfiguration.class));
|
||||
|
@ -161,7 +161,7 @@ bom {
|
||||
]
|
||||
}
|
||||
}
|
||||
library("Testcontainers", "1.15.0") {
|
||||
library("Testcontainers", "1.14.3") {
|
||||
group("org.testcontainers") {
|
||||
imports = [
|
||||
"testcontainers-bom"
|
||||
|
@ -11,15 +11,12 @@ dependencies {
|
||||
compileOnly("com.datastax.oss:java-driver-core")
|
||||
compileOnly("javax.servlet:javax.servlet-api")
|
||||
compileOnly("junit:junit")
|
||||
compileOnly("org.elasticsearch:elasticsearch")
|
||||
compileOnly("org.junit.jupiter:junit-jupiter")
|
||||
compileOnly("org.junit.platform:junit-platform-engine")
|
||||
compileOnly("org.mockito:mockito-core")
|
||||
compileOnly("org.neo4j:neo4j-ogm-core")
|
||||
compileOnly("org.springframework:spring-context")
|
||||
compileOnly("org.springframework.data:spring-data-redis")
|
||||
compileOnly("org.testcontainers:cassandra")
|
||||
compileOnly("org.testcontainers:elasticsearch")
|
||||
compileOnly("org.testcontainers:testcontainers")
|
||||
|
||||
implementation("org.apache.maven.resolver:maven-resolver-connector-basic")
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.testsupport.testcontainers;
|
||||
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
/**
|
||||
* Extension of {@link org.testcontainers.containers.CassandraContainer} that provides a
|
||||
* default version.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.3.6
|
||||
*/
|
||||
public class CassandraContainer extends org.testcontainers.containers.CassandraContainer<CassandraContainer> {
|
||||
|
||||
public CassandraContainer() {
|
||||
super(DockerImageName.parse("cassandra").withTag("3.11.2"));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user