-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: redo not totally working Testcontainers config for Kafka
- Loading branch information
Showing
16 changed files
with
37 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
28 changes: 10 additions & 18 deletions
28
search-service/src/test/kotlin/com/egm/stellio/search/support/WithKafkaContainer.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
package com.egm.stellio.search.support | ||
|
||
import org.springframework.test.context.DynamicPropertyRegistry | ||
import org.springframework.test.context.DynamicPropertySource | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection | ||
import org.testcontainers.junit.jupiter.Container | ||
import org.testcontainers.junit.jupiter.Testcontainers | ||
import org.testcontainers.kafka.ConfluentKafkaContainer | ||
import org.testcontainers.utility.DockerImageName | ||
|
||
interface WithKafkaContainer { | ||
@Testcontainers | ||
@Suppress("UtilityClassWithPublicConstructor") | ||
open class WithKafkaContainer { | ||
|
||
companion object { | ||
|
||
private val kafkaImage: DockerImageName = | ||
DockerImageName.parse("confluentinc/cp-kafka:7.6.0") | ||
|
||
private val kafkaContainer = ConfluentKafkaContainer(kafkaImage).apply { | ||
withReuse(true) | ||
} | ||
|
||
@Container | ||
@ServiceConnection | ||
@JvmStatic | ||
@DynamicPropertySource | ||
fun properties(registry: DynamicPropertyRegistry) { | ||
registry.add("spring.kafka.bootstrap-servers") { kafkaContainer.bootstrapServers } | ||
} | ||
|
||
init { | ||
kafkaContainer.start() | ||
val kafkaContainer = ConfluentKafkaContainer("confluentinc/cp-kafka:7.6.0").apply { | ||
withReuse(true) | ||
} | ||
} | ||
} |
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
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
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
28 changes: 10 additions & 18 deletions
28
...iption-service/src/test/kotlin/com/egm/stellio/subscription/support/WithKafkaContainer.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
package com.egm.stellio.subscription.support | ||
|
||
import org.springframework.test.context.DynamicPropertyRegistry | ||
import org.springframework.test.context.DynamicPropertySource | ||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection | ||
import org.testcontainers.junit.jupiter.Container | ||
import org.testcontainers.junit.jupiter.Testcontainers | ||
import org.testcontainers.kafka.ConfluentKafkaContainer | ||
import org.testcontainers.utility.DockerImageName | ||
|
||
interface WithKafkaContainer { | ||
@Testcontainers | ||
@Suppress("UtilityClassWithPublicConstructor") | ||
open class WithKafkaContainer { | ||
|
||
companion object { | ||
|
||
private val kafkaImage: DockerImageName = | ||
DockerImageName.parse("confluentinc/cp-kafka:7.6.0") | ||
|
||
private val kafkaContainer = ConfluentKafkaContainer(kafkaImage).apply { | ||
withReuse(true) | ||
} | ||
|
||
@Container | ||
@ServiceConnection | ||
@JvmStatic | ||
@DynamicPropertySource | ||
fun properties(registry: DynamicPropertyRegistry) { | ||
registry.add("spring.kafka.bootstrap-servers") { kafkaContainer.bootstrapServers } | ||
} | ||
|
||
init { | ||
kafkaContainer.start() | ||
val kafkaContainer = ConfluentKafkaContainer("confluentinc/cp-kafka:7.6.0").apply { | ||
withReuse(true) | ||
} | ||
} | ||
} |