Switching to 30s timeout for the SSL tests + loading from classloader rather than file path

This commit is contained in:
Viktor Klang 2012-06-18 18:47:35 +02:00
parent a2c15f8321
commit 8eca3692c8

View file

@ -19,9 +19,8 @@ import akka.util.duration._
object Configuration { object Configuration {
// set this in your JAVA_OPTS to see all ssl debug info: "-Djavax.net.debug=ssl,keymanager" // set this in your JAVA_OPTS to see all ssl debug info: "-Djavax.net.debug=ssl,keymanager"
// The certificate will expire in 2109 // The certificate will expire in 2109
private val trustStore = getPath("truststore") private val trustStore = getClass.getClassLoader.getResource("truststore").getPath
private val keyStore = getPath("keystore") private val keyStore = getClass.getClassLoader.getResource("keystore").getPath
private def getPath(name: String): String = (new File("akka-remote/src/test/resources/" + name)).getAbsolutePath.replace("\\", "\\\\")
private val conf = """ private val conf = """
akka { akka {
actor.provider = "akka.remote.RemoteActorRefProvider" actor.provider = "akka.remote.RemoteActorRefProvider"
@ -114,15 +113,17 @@ abstract class Ticket1978CommunicationSpec(val cipherEnabledconfig: (String, Boo
"support remote look-ups" in { "support remote look-ups" in {
here ! "ping" here ! "ping"
expectMsgPF() { expectMsgPF(timeout.duration) {
case ("pong", s: AnyRef) if s eq testActor true case ("pong", s: AnyRef) if s eq testActor true
} }
} }
"send error message for wrong address" in { "send error message for wrong address" in {
EventFilter.error(start = "dropping", occurrences = 1).intercept { within(timeout.duration) {
system.actorFor("akka://remotesys@localhost:12346/user/echo") ! "ping" EventFilter.error(start = "dropping", occurrences = 1).intercept {
}(other) system.actorFor("akka://remotesys@localhost:12346/user/echo") ! "ping"
}(other)
}
} }
"support ask" in { "support ask" in {
@ -133,52 +134,58 @@ abstract class Ticket1978CommunicationSpec(val cipherEnabledconfig: (String, Boo
} }
"send dead letters on remote if actor does not exist" in { "send dead letters on remote if actor does not exist" in {
EventFilter.warning(pattern = "dead.*buh", occurrences = 1).intercept { within(timeout.duration) {
system.actorFor("akka://remote-sys@localhost:12346/does/not/exist") ! "buh" EventFilter.warning(pattern = "dead.*buh", occurrences = 1).intercept {
}(other) system.actorFor("akka://remote-sys@localhost:12346/does/not/exist") ! "buh"
}(other)
}
} }
"create and supervise children on remote node" in { "create and supervise children on remote node" in {
val r = system.actorOf(Props[Echo], "blub") within(timeout.duration) {
r.path.toString must be === "akka://remote-sys@localhost:12346/remote/Ticket1978CommunicationSpec@localhost:12345/user/blub" val r = system.actorOf(Props[Echo], "blub")
r ! 42 r.path.toString must be === "akka://remote-sys@localhost:12346/remote/Ticket1978CommunicationSpec@localhost:12345/user/blub"
expectMsg(42) r ! 42
EventFilter[Exception]("crash", occurrences = 1).intercept { expectMsg(42)
r ! new Exception("crash") EventFilter[Exception]("crash", occurrences = 1).intercept {
}(other) r ! new Exception("crash")
expectMsg("preRestart") }(other)
r ! 42 expectMsg("preRestart")
expectMsg(42) r ! 42
system.stop(r) expectMsg(42)
expectMsg("postStop") system.stop(r)
expectMsg("postStop")
}
} }
"look-up actors across node boundaries" in { "look-up actors across node boundaries" in {
val l = system.actorOf(Props(new Actor { within(timeout.duration) {
def receive = { val l = system.actorOf(Props(new Actor {
case (p: Props, n: String) sender ! context.actorOf(p, n) def receive = {
case s: String sender ! context.actorFor(s) case (p: Props, n: String) sender ! context.actorOf(p, n)
} case s: String sender ! context.actorFor(s)
}), "looker") }
l ! (Props[Echo], "child") }), "looker")
val r = expectMsgType[ActorRef] l ! (Props[Echo], "child")
r ! (Props[Echo], "grandchild") val r = expectMsgType[ActorRef]
val remref = expectMsgType[ActorRef] r ! (Props[Echo], "grandchild")
remref.isInstanceOf[LocalActorRef] must be(true) val remref = expectMsgType[ActorRef]
val myref = system.actorFor(system / "looker" / "child" / "grandchild") remref.isInstanceOf[LocalActorRef] must be(true)
myref.isInstanceOf[RemoteActorRef] must be(true) val myref = system.actorFor(system / "looker" / "child" / "grandchild")
myref ! 43 myref.isInstanceOf[RemoteActorRef] must be(true)
expectMsg(43) myref ! 43
lastSender must be theSameInstanceAs remref expectMsg(43)
r.asInstanceOf[RemoteActorRef].getParent must be(l) lastSender must be theSameInstanceAs remref
system.actorFor("/user/looker/child") must be theSameInstanceAs r r.asInstanceOf[RemoteActorRef].getParent must be(l)
Await.result(l ? "child/..", timeout.duration).asInstanceOf[AnyRef] must be theSameInstanceAs l system.actorFor("/user/looker/child") must be theSameInstanceAs r
Await.result(system.actorFor(system / "looker" / "child") ? "..", timeout.duration).asInstanceOf[AnyRef] must be theSameInstanceAs l Await.result(l ? "child/..", timeout.duration).asInstanceOf[AnyRef] must be theSameInstanceAs l
Await.result(system.actorFor(system / "looker" / "child") ? "..", timeout.duration).asInstanceOf[AnyRef] must be theSameInstanceAs l
}
} }
"not fail ask across node boundaries" in { "not fail ask across node boundaries" in {
val f = for (_ 1 to 1000) yield here ? "ping" mapTo manifest[(String, ActorRef)] val f = for (_ 1 to 1000) yield here ? "ping" mapTo manifest[(String, ActorRef)]
Await.result(Future.sequence(f), remaining).map(_._1).toSet must be(Set("pong")) Await.result(Future.sequence(f), timeout.duration).map(_._1).toSet must be(Set("pong"))
} }
} else { } else {
"not be run when the cipher is not supported by the platform this test is currently being executed on" ignore { "not be run when the cipher is not supported by the platform this test is currently being executed on" ignore {