Created
April 8, 2020 01:58
-
-
Save Kalimaha/5c158db6dee20ce40816373098529494 to your computer and use it in GitHub Desktop.
K6 Testcontainers
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
package au.com.mebank.awesomeservice.performance | |
import org.junit.jupiter.api.BeforeEach | |
import org.junit.jupiter.api.Test | |
import org.testcontainers.containers.GenericContainer | |
import org.testcontainers.images.builder.ImageFromDockerfile | |
class KGenericContainer(dockerImageName: ImageFromDockerfile): | |
GenericContainer<KGenericContainer>(dockerImageName) | |
class RandomIdPerformanceTest { | |
private lateinit var k6Image: ImageFromDockerfile | |
private lateinit var k6Container: KGenericContainer | |
@BeforeEach | |
fun init() { | |
k6Image = | |
ImageFromDockerfile() | |
.withFileFromClasspath("Dockerfile", "Dockerfile") | |
.withFileFromClasspath("tests/", "tests/") | |
.withFileFromClasspath("docker-run.sh", "docker-run.sh") | |
.withFileFromClasspath("wait-for-it.sh", "wait-for-it.sh") | |
.withFileFromClasspath("run-all-tests.sh", "run-all-tests.sh") | |
k6Container = | |
KGenericContainer(k6Image) | |
.withEnv("WS_PROTOCOL", "http").withEnv("WS_HOST", "http").withEnv("WS_PORT", "http").withEnv("MB_PORT", "http").withEnv("MB_HOST", "http") | |
k6Container.start() | |
} | |
@Test | |
fun `tests throughput performance`() { | |
k6Container.execInContainer("./run-all-tests.sh") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment