-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reForkOptions should include envVars.
- Loading branch information
Showing
8 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
sbtPlugin := true | ||
|
||
scalacOptions := Seq("-deprecation", "-encoding", "utf8") | ||
|
||
// Scripted test options. | ||
|
||
scriptedSettings | ||
scriptedLaunchOpts += s"-Dplugin.version=${version.value}" | ||
scriptedBufferLog := false | ||
test in Test <<= (test in Test).dependsOn(scripted.toTask("")) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") | ||
|
||
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
scalaVersion := "2.11.8" | ||
|
||
libraryDependencies ++= Seq( | ||
"com.typesafe.akka" %% "akka-actor" % "2.4.7", | ||
"io.spray" %% "spray-can" % "1.3.2", | ||
"io.spray" %% "spray-routing" % "1.3.2" | ||
) | ||
|
||
enablePlugins(RevolverPlugin) | ||
|
||
envVars in reStart += "TEST_VAR" -> "OK" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("io.spray" % "sbt-revolver" % System.getProperty("plugin.version")) |
30 changes: 30 additions & 0 deletions
30
src/sbt-test/sbt-revolver/env-vars/src/main/scala/TestService.scala
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package spray.revolver.test | ||
|
||
import akka.actor.{ Actor, ActorSystem, Props } | ||
import akka.io.IO | ||
import akka.pattern.ask | ||
import akka.util.Timeout | ||
import spray.can.Http | ||
import spray.routing.HttpServiceActor | ||
|
||
import scala.concurrent.duration._ | ||
|
||
object TestService extends App { | ||
implicit val system = ActorSystem("test-system") | ||
import system.dispatcher | ||
|
||
implicit val timeout = Timeout(5.seconds) | ||
|
||
val service = system.actorOf(Props(classOf[TestServiceActor]), "service") | ||
IO(Http) ? Http.Bind(service, interface = "0.0.0.0", port = 8888) | ||
} | ||
|
||
class TestServiceActor extends HttpServiceActor { | ||
override def receive = runRoute(route) | ||
|
||
val route = { | ||
get { | ||
complete(sys.env("TEST_VAR")) | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
> reStart | ||
$ sleep 2000 | ||
$ exec curl http://0.0.0.0:8888 | ||
> reStop |