Skip to content

Instantly share code, notes, and snippets.

@dnatic09
Created May 22, 2020 01:21
Show Gist options
  • Save dnatic09/150d931a6c78eb864705b1e057dbfec0 to your computer and use it in GitHub Desktop.
Save dnatic09/150d931a6c78eb864705b1e057dbfec0 to your computer and use it in GitHub Desktop.
Empty test that starts a Redis container
class TestContainersExample1 extends FlatSpec with Matchers with BeforeAndAfterAll {
private val container = GenericContainer("redis:5.0.8-alpine",
waitStrategy = Wait.forListeningPort()
)
container.start()
override def afterAll(): Unit = {
super.afterAll()
container.stop()
}
"TestContainers" should "start a Docker container" in {
val cmd = container.execInContainer("/usr/local/bin/redis-cli", "PING")
val output = cmd.getStdout
val expected = "PONG"
output.contains(expected) shouldBe true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment