Skip to content

Instantly share code, notes, and snippets.

Last active Feb 27, 2020
What would you like to do?
AWS unit tests with localstack and scalatest
import cloud.localstack.docker.annotation.LocalstackDockerProperties
import cloud.localstack.TestUtils
import org.scalatest.{BeforeAndAfterEach, FlatSpec}
import ...LocalstackSpec
@LocalstackDockerProperties(services = Array("s3"))
class ExampleSpec
extends FlatSpec
with BeforeAndAfterEach
with LocalStackSpec {
override def beforeEach() = localstackStart()
override def afterEach() = localstackStop()
"s3 access" should "work" in {
// access s3 API @ localhost
val s3 = TestUtils.getClientS3
import cloud.localstack.Localstack
import cloud.localstack.docker.annotation.LocalstackDockerAnnotationProcessor
trait LocalstackSpec {
def localstackStart() = {
val config = LocalstackSpec.processor.process(this.getClass)
def localstackStop() = Localstack.INSTANCE.stop()
object LocalstackSpec {
val processor = new LocalstackDockerAnnotationProcessor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment