From eee584d995cf1f66cb05685bd4977043f6533597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sad=C4=B1k=20Adem=20Ekici?= <32831702+ademekici@users.noreply.github.com> Date: Wed, 10 Jan 2024 15:37:29 +0300 Subject: [PATCH] feature: add image version field to the couchbase options (#297) * feature: add image version field to the couchbase options * fix: set couchbase image version as latest for test --- .../com/trendyol/stove/testing/e2e/couchbase/Options.kt | 9 +++++++-- .../testing/e2e/couchbase/CouchbaseTestSystemTests.kt | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/stove-testing-e2e-couchbase/src/main/kotlin/com/trendyol/stove/testing/e2e/couchbase/Options.kt b/lib/stove-testing-e2e-couchbase/src/main/kotlin/com/trendyol/stove/testing/e2e/couchbase/Options.kt index 8b88462d..7105614e 100644 --- a/lib/stove-testing-e2e-couchbase/src/main/kotlin/com/trendyol/stove/testing/e2e/couchbase/Options.kt +++ b/lib/stove-testing-e2e-couchbase/src/main/kotlin/com/trendyol/stove/testing/e2e/couchbase/Options.kt @@ -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 = { _ -> listOf() }, val objectMapper: ObjectMapper = StoveObjectMapper.byConfiguring { registerModule(JsonValueModule()) } ) : SystemOptions, ConfiguresExposedConfiguration { @@ -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) } diff --git a/lib/stove-testing-e2e-couchbase/src/test/kotlin/com/trendyol/stove/testing/e2e/couchbase/CouchbaseTestSystemTests.kt b/lib/stove-testing-e2e-couchbase/src/test/kotlin/com/trendyol/stove/testing/e2e/couchbase/CouchbaseTestSystemTests.kt index 1f3f7143..9df364b3 100644 --- a/lib/stove-testing-e2e-couchbase/src/test/kotlin/com/trendyol/stove/testing/e2e/couchbase/CouchbaseTestSystemTests.kt +++ b/lib/stove-testing-e2e-couchbase/src/test/kotlin/com/trendyol/stove/testing/e2e/couchbase/CouchbaseTestSystemTests.kt @@ -22,7 +22,12 @@ class Setup : AbstractProjectConfig() { TestSystem {} .with { couchbase { - CouchbaseSystemOptions(defaultBucket = TEST_BUCKET) + CouchbaseSystemOptions( + defaultBucket = TEST_BUCKET, + containerOptions = ContainerOptions( + imageVersion = "latest" + ) + ) .migrations { register() }