pl.allegro.tech.servicemesh.envoycontrol.config.service.OAuthServerContainer.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.testcontainers.containers.Network
import org.testcontainers.containers.wait.strategy.Wait
import org.testcontainers.images.builder.ImageFromDockerfile
import pl.allegro.tech.servicemesh.envoycontrol.config.testcontainers.GenericContainer
class OAuthServerContainer :
GenericContainer(ImageFromDockerfile().withFileFromClasspath("Dockerfile", "oauth/Dockerfile")),
ServiceContainer {
override fun configure() {
super.configure()
withEnv("PORT", OAUTH_PORT.toString())
withNetwork(Network.SHARED)
withNetworkAliases(NETWORK_ALIAS)
addExposedPort(OAUTH_PORT)
waitingFor(Wait.forHttp("/").forStatusCode(200))
}
fun address(): String = "http://${ipAddress()}:${getMappedPort(OAUTH_PORT)}"
override fun port(): Int = getMappedPort(OAUTH_PORT)
fun oAuthPort() = OAUTH_PORT
fun networkAlias() = NETWORK_ALIAS
companion object {
const val NETWORK_ALIAS = "oauth"
const val OAUTH_PORT = 9997
}
}