-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(environment): create the EZE environment for spec tests
- Loading branch information
Showing
7 changed files
with
160 additions
and
35 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
15 changes: 15 additions & 0 deletions
15
zeebe-test-runner/src/main/kotlin/io/zeebe/bpmnspec/runner/zeebe/TestEnvironment.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.zeebe.bpmnspec.runner.zeebe | ||
|
||
import io.camunda.zeebe.client.ZeebeClient | ||
import io.zeebe.bpmnspec.runner.zeebe.zeeqs.ZeeqsClient | ||
|
||
interface TestEnvironment { | ||
val zeebeClient: ZeebeClient | ||
val zeeqsClient: ZeeqsClient | ||
|
||
val isRunning: Boolean | ||
|
||
fun setup() | ||
|
||
fun cleanUp() | ||
} |
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
46 changes: 46 additions & 0 deletions
46
zeebe-test-runner/src/main/kotlin/io/zeebe/bpmnspec/runner/zeebe/eze/EzeTestEnvironment.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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.zeebe.bpmnspec.runner.zeebe.eze | ||
|
||
import io.camunda.zeebe.client.ZeebeClient | ||
import io.zeebe.bpmnspec.runner.zeebe.TestEnvironment | ||
import io.zeebe.bpmnspec.runner.zeebe.ZeebeEnvironment | ||
import io.zeebe.bpmnspec.runner.zeebe.zeeqs.ZeeqsClient | ||
import io.zeebe.hazelcast.exporter.HazelcastExporter | ||
import org.camunda.community.eze.EngineFactory | ||
import org.camunda.community.eze.ZeebeEngine | ||
import org.testcontainers.Testcontainers | ||
import org.testcontainers.containers.wait.strategy.Wait | ||
|
||
class EzeTestEnvironment( | ||
private val hazelcastExporter: HazelcastExporter = HazelcastExporter(), | ||
private val zeebeEngine: ZeebeEngine = EngineFactory.create(listOf(hazelcastExporter)), | ||
private val zeeqsGraphqlPort: Int = 9000, | ||
private val zeeqsImage: String = "ghcr.io/camunda-community-hub/zeeqs", | ||
private val zeeqsImageVersion: String = "2.4.0", | ||
private val zeeqsContainer: ZeebeEnvironment.ZeeqsContainer = ZeebeEnvironment | ||
.ZeeqsContainer(zeeqsImage, zeeqsImageVersion) | ||
.withEnv("zeebe.client.worker.hazelcast.connection", "host.testcontainers.internal:5701") | ||
.withExposedPorts(zeeqsGraphqlPort) | ||
.waitingFor(Wait.forHttp("/actuator/health")) | ||
) : TestEnvironment { | ||
override lateinit var zeebeClient: ZeebeClient | ||
override lateinit var zeeqsClient: ZeeqsClient | ||
override var isRunning: Boolean = false | ||
private val closingSteps = mutableListOf<AutoCloseable>() | ||
|
||
override fun setup() { | ||
zeebeEngine.start() | ||
Testcontainers.exposeHostPorts(5701) | ||
zeebeClient = zeebeEngine.createClient() | ||
zeeqsContainer.start() | ||
zeeqsClient = ZeeqsClient("localhost:${zeeqsContainer.getMappedPort(zeeqsGraphqlPort)}/graphql") | ||
closingSteps.add(zeebeClient) | ||
closingSteps.add(AutoCloseable { zeebeEngine.stop() }) | ||
closingSteps.add(zeeqsContainer) | ||
isRunning = true | ||
} | ||
|
||
override fun cleanUp() { | ||
closingSteps.forEach(AutoCloseable::close) | ||
isRunning = false | ||
} | ||
} |
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