Skip to content

Instantly share code, notes, and snippets.

@fagossa
Last active October 20, 2017 13:20
Show Gist options
  • Save fagossa/617aa4cd9433b6ca232da03a39f7e588 to your computer and use it in GitHub Desktop.
Save fagossa/617aa4cd9433b6ca232da03a39f7e588 to your computer and use it in GitHub Desktop.
build.sbt with pre and post test
lazy val root = project.in(file("."))
.configs(IntegrationTest)
.settings(Defaults.itSettings : _*)
Revolver.settings
lazy val startTask = TaskKey[Unit]("startDocker", "Start docker")
startTask := {
import sys.process._
// EXECUTER DOCKER-COMPOSE UP
println("waiting ...")
Thread.sleep(4000)
println("containers started!")
}
test in IntegrationTest := ((test in IntegrationTest) dependsOn startTask).value
lazy val stopTask = TaskKey[Unit]("stopDocker", "Stop docker")
stopTask := {
import sys.process._
// ARRETER DOCKER-COMPOSE RM
println(s"containers stopped")
}
stopTask <<= stopTask triggeredBy (test in IntegrationTest)
fork in run := true
fork in Test := true
fork in IntegrationTest := true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment