Skip to content

Couchbase

Prerequisites

1. Docker Image

 docker buildx imagetools create couchbase/server:latest --tag YOUR_REGISTRY/couchbase/server:latest

2. Library

    dependencies {
        testImplementation("com.trendyol:stove-testing-e2e-couchbase:$version")
    }
 <dependency>
    <groupId>com.trendyol</groupId>
    <artifactId>stove-testing-e2e-couchbase</artifactId>
    <version>${stove-version}</version>
 </dependency>

Configure

After getting the library from the maven source, while configuring TestSystem you will have access to withCouchbase function. This function configures the Couchbase Docker container that is going to be started.

Here you can define a defaultBucket name.

Warning

Make sure that your application has the same bucket names.

TestSystem()
    .withCouchbase(
        CouchbaseSystemOptions(defaultBucket = "test-bucket", configureExposedConfiguration = { cfg ->
            listOf(
                "couchbase.hosts=${cfg.hostsWithPort}",
                "couchbase.username=${cfg.username}",
                "couchbase.password=${cfg.password}"
            )
        })
    )
    .run()

Stove exposes configuration that is generated by the execution, so you can pass the real connection strings and configurations to your Spring application before it starts. Your application will start with the physical dependencies that are spun-up by the framework.

Migrations

Stove provides a way to run migrations before the test starts.