-
-
Save henesgokdag/bb9112393fe5a61d949bdd1f513e1ad8 to your computer and use it in GitHub Desktop.
CouchbaseTestContainer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Testcontainers | |
@ActiveProfiles("container") | |
@SpringBootTest | |
public class CouchbaseTestContainer { | |
private static final DockerImageName COUCHBASE_IMAGE_ENTERPRISE = DockerImageName.parse("couchbase:enterprise") | |
.asCompatibleSubstituteFor("couchbase/server") | |
.withTag("7.1.0"); | |
@ClassRule | |
public final static CouchbaseContainer container = new CouchbaseContainer(COUCHBASE_IMAGE_ENTERPRISE) | |
.withBucket(new BucketDefinition("Message")) | |
.withCredentials("enes","enesenes") | |
.withStartupTimeout(Duration.ofSeconds(90)) | |
.waitingFor(Wait.defaultWaitStrategy()); | |
@BeforeClass | |
public static void beforeClass(){ container.start();} | |
@DynamicPropertySource | |
static void bindCouchbaseProperties(DynamicPropertyRegistry registry){ | |
container.start(); | |
await().until(container::isRunning); | |
registry.add("spring.couchbase.host",container::getConnectionString); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment