Last active
October 20, 2017 13:20
-
-
Save fagossa/617aa4cd9433b6ca232da03a39f7e588 to your computer and use it in GitHub Desktop.
build.sbt with pre and post test
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
| 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