Skip to content

Upgrade to Testcontainers 1.14.0 #20936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spring-boot-project/spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ dependencies {
testImplementation("org.springframework.kafka:spring-kafka-test")
testImplementation("org.springframework.security:spring-security-test")
testImplementation("org.testcontainers:cassandra")
testImplementation("org.testcontainers:couchbase")
testImplementation("org.testcontainers:elasticsearch")
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:testcontainers")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.env.ClusterEnvironment;
import com.couchbase.client.java.manager.bucket.BucketSettings;
import org.junit.jupiter.api.Test;
import org.testcontainers.couchbase.BucketDefinition;
import org.testcontainers.couchbase.CouchbaseContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

Expand All @@ -45,9 +46,9 @@ class CouchbaseAutoConfigurationIntegrationTests {
private static final String BUCKET_NAME = "cbbucket";

@Container
static final CouchbaseContainer couchbase = new CouchbaseContainer().withClusterAdmin("spring", "password")
static final CouchbaseContainer couchbase = new CouchbaseContainer().withCredentials("spring", "password")
.withStartupAttempts(5).withStartupTimeout(Duration.ofMinutes(10))
.withNewBucket(BucketSettings.create(BUCKET_NAME));
.withBucket(new BucketDefinition(BUCKET_NAME));

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snicoll FYI "spring.couchbase.connection-string:localhost:" + couchbase.getMappedPort(11210) isn't entirely correct.

Consider using "spring.couchbase.connection-string:" + couchbase.getConnectionString() (takes getContainerIpAddress() into consideration).

And, if more services are tested, the environment needs to be configured:
https://www.testcontainers.org/modules/databases/couchbase/#usage-example

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's good to know, I've polished that in 04544f9

.withConfiguration(AutoConfigurations.of(CouchbaseAutoConfiguration.class))
Expand Down
Loading