Skip to content

Testcontainers module for Couchbase. Couchbase is a NoSQL document Database.

License

Notifications You must be signed in to change notification settings

tchlyah/testcontainers-java-module-couchbase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TestContainers Couchbase Module

Testcontainers module for Couchbase. Couchbase is a Document oriented NoSQL database.

See testcontainers.org for more information about Testcontainers.

Usage example

Running Couchbase as a stand-in in a test:

Create you own bucket

public class SomeTest {

    @Rule
    public CouchbaseContainer couchbase = new CouchbaseContainer()
             .withNewBucket(DefaultBucketSettings.builder()
                        .enableFlush(true)
                        .name('bucket-name')
                        .quota(100)
                        .type(BucketType.COUCHBASE)
                        .build());
    
    @Test
    public void someTestMethod() {
        Bucket bucket = couchbase.getCouchbaseCluster().openBucket('bucket-name')
        
        ... interact with client as if using Couchbase normally

Use preconfigured default bucket

Bucket is cleared after each test

public class SomeTest extends AbstractCouchbaseTest {

    @Test
    public void someTestMethod() {
        Bucket bucket = getBucket();
        
        ... interact with client as if using Couchbase normally

Special consideration

Begining from version 1.2, Couchbase testContainer is configured to use random available ports for all ports :


Build Status Maven Central Licence