markusthoemmes commented on a change in pull request #2531: Share bookkeeping 
data across controllers
URL: 
https://github.com/apache/incubator-openwhisk/pull/2531#discussion_r138342323
 
 

 ##########
 File path: 
tests/src/test/scala/whisk/core/loadBalancer/test/LoadBalancerDataTests.scala
 ##########
 @@ -17,70 +17,108 @@
 
 package whisk.core.loadBalancer.test
 
+import akka.actor.ActorSystem
+import com.typesafe.config.{ConfigFactory, ConfigValueFactory}
 import org.scalatest.{FlatSpec, Matchers}
 import whisk.core.entity.{ActivationId, UUID, WhiskActivation}
-import whisk.core.loadBalancer.{ActivationEntry, LoadBalancerData}
+import whisk.core.loadBalancer.{ActivationEntry, DistributedLoadBalancerData, 
LoadBalancerData}
 
-import scala.concurrent.{Promise}
+import scala.concurrent.{Await, Future, Promise}
 import whisk.core.entity.InstanceId
 
+import scala.concurrent.duration._
+
 class LoadBalancerDataTests extends FlatSpec with Matchers {
 
   val activationIdPromise = Promise[Either[ActivationId, WhiskActivation]]()
   val firstEntry: ActivationEntry = ActivationEntry(ActivationId(), UUID(), 
InstanceId(0), activationIdPromise)
   val secondEntry: ActivationEntry = ActivationEntry(ActivationId(), UUID(), 
InstanceId(1), activationIdPromise)
 
+  val port = 2552
+  val config = ConfigFactory
+    .parseString("akka.cluster { seed-nodes = 
[\"akka.tcp://[email protected]:"+ port + "\"] }")
+    .withValue("akka.remote.netty.tcp.hostname", 
ConfigValueFactory.fromAnyRef("127.0.0.1"))
+    .withValue("akka.remote.netty.tcp.port", 
ConfigValueFactory.fromAnyRef(port))
+    .withValue("akka.cluster.auto-down-unreachable-after", 
ConfigValueFactory.fromAnyRef("10s"))
+    .withValue("akka.actor.provider", ConfigValueFactory.fromAnyRef("cluster"))
+    .withValue("akka.remote.log-remote-lifecycle-events", 
ConfigValueFactory.fromAnyRef("off"))
+    .withFallback(ConfigFactory.load())
+
+  implicit val actorSystem = ActorSystem("controller-actor-system", config)
+
+
+  def await[A](f: Future[A], timeout: FiniteDuration = 1.second) = 
Await.result(f, timeout)
+
   behavior of "LoadBalancerData"
 
   it should "return the number of activations for a namespace" in {
-
-    val loadBalancerData = new LoadBalancerData()
+    val loadBalancerData = new DistributedLoadBalancerData()
 
 Review comment:
   Do we lose testcoverage for the local version? Intended?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to