pl.allegro.tech.servicemesh.envoycontrol.config.service.EchoServiceExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of envoy-control-tests Show documentation
Show all versions of envoy-control-tests Show documentation
Production-ready Control Plane for Service Mesh based on Envoy Proxy.
package pl.allegro.tech.servicemesh.envoycontrol.config.service
import org.junit.jupiter.api.extension.ExtensionContext
import pl.allegro.tech.servicemesh.envoycontrol.config.sharing.ContainerPool
class EchoServiceExtension : ServiceExtension {
companion object {
private val pool = ContainerPool { EchoContainer() }
}
var started = false
private var container: EchoContainer? = null
override fun container() = container!!
override fun beforeAll(context: ExtensionContext) {
if (started) {
return
}
container = pool.acquire(this)
started = true
}
override fun afterAll(context: ExtensionContext) {
pool.release(this)
}
}