Skip to content

Commit

Permalink
feature: add image version field to the couchbase options (#297)
Browse files Browse the repository at this point in the history
* feature: add image version field to the couchbase options

* fix: set couchbase image version as latest for test
  • Loading branch information
ademekici authored Jan 10, 2024
1 parent a44bf0b commit eee584d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data class CouchbaseExposedConfiguration(

data class CouchbaseSystemOptions(
val defaultBucket: String,
val registry: String = DEFAULT_REGISTRY,
val containerOptions: ContainerOptions = ContainerOptions(),
override val configureExposedConfiguration: (CouchbaseExposedConfiguration) -> List<String> = { _ -> listOf() },
val objectMapper: ObjectMapper = StoveObjectMapper.byConfiguring { registerModule(JsonValueModule()) }
) : SystemOptions, ConfiguresExposedConfiguration<CouchbaseExposedConfiguration> {
Expand All @@ -48,10 +48,15 @@ data class CouchbaseContext(
val options: CouchbaseSystemOptions
)

data class ContainerOptions(
val registry: String = DEFAULT_REGISTRY,
val imageVersion: String = "latest"
)

internal fun TestSystem.withCouchbase(options: CouchbaseSystemOptions): TestSystem {
val bucketDefinition = BucketDefinition(options.defaultBucket)
val couchbaseContainer =
withProvidedRegistry("couchbase/server", options.registry) {
withProvidedRegistry("couchbase/server:${options.containerOptions.imageVersion}", options.containerOptions.registry) {
CouchbaseContainer(it).withBucket(bucketDefinition)
.withReuse(this.options.keepDependenciesRunning)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ class Setup : AbstractProjectConfig() {
TestSystem {}
.with {
couchbase {
CouchbaseSystemOptions(defaultBucket = TEST_BUCKET)
CouchbaseSystemOptions(
defaultBucket = TEST_BUCKET,
containerOptions = ContainerOptions(
imageVersion = "latest"
)
)
.migrations {
register<DefaultMigration>()
}
Expand Down

0 comments on commit eee584d

Please sign in to comment.