Created
May 22, 2020 01:21
-
-
Save dnatic09/150d931a6c78eb864705b1e057dbfec0 to your computer and use it in GitHub Desktop.
Empty test that starts a Redis container
This file contains hidden or 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
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