Hi,

On 8 March 2014 at 11:25:00, lee json ([email protected]) wrote:

I am testing akka multi node testkit (scala 2.10, akka 2.2.3). Following the 
example at 

http://letitcrash.com/post/35341473217/2-1-spotlight-multi-node-testing
http://doc.akka.io/docs/akka/2.2.3/dev/multi-node-testing.html

When running with maven command

mvn clean install -Dtest=TestMultiNodeExample -Dmultinode.index=1 
-Dmultinode.max-nodes=2 -Dmultinode.host=127.0.0.1 
-Dmultinode.server-host=127.0.0.1

The test result throws below exception. How can I fix it? 


I’m not sure what happens since you don’t provide any logs, but one thing wrong 
with your command line is that you need to provide different values for 
“multinode.index” for each node. This is what tells them which role to run. I 
guess that both test classes now try to start up as node number 1 which is not 
possible.

B/

Thanks

java.lang.RuntimeException: unexpected transition: 
Transition(Actor[akka://TestMultiNodeExample/user/TestConductorClient#833078795],Connecting,Failed)
at 
akka.remote.testconductor.Player$$anonfun$6$$anon$1$$anonfun$receive$1.applyOrElse(Player.scala:62)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:498)
at akka.actor.ActorCell.invoke(ActorCell.scala:456)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:237)
at akka.dispatch.Mailbox.run(Mailbox.scala:219)
at 
akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262)
at 
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
at 
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

TestMultiNodeExample.scala

@RunWith(classOf[JUnitRunner])
class TestMultiNodeExample extends MultiNodeSpec(MultiNodeExampleConfig)
  with WordSpecLike with MustMatchers with BeforeAndAfterAll with 
ImplicitSender {
 
  import MultiNodeExampleConfig._
 
  def initialParticipants = roles.size
 
  "A TestMultiNodeExample" must {
 
    "wait for all nodes to enter a barrier" in {
      enterBarrier("startup")
    }
 
    "send to and receive from a remote node" in {
      runOn(node1) {
        // wait for the other node to have deployed an actor
        enterBarrier("deployed")
        val ponger = system.actorSelection(node(node2) / "user" / "ponger")
        ponger ! "ping"
        expectMsg("pong")
      }
 
      runOn(node2) {
              // deploy the ponger actor
        system.actorOf(Props[Ponger], "ponger")
        enterBarrier("deployed")
      }
 
      // wait for all nodes to finish the test
      enterBarrier("finished")
    }
  }
 
  // hook the MultiNodeSpec into ScalaTest
  override def beforeAll() = multiNodeSpecBeforeAll() 
  override def afterAll() = multiNodeSpecAfterAll()
}

MultiNodeExampleConfig.scala

object MultiNodeExampleConfig extends MultiNodeConfig {
  val node1 = role("node1")
  val node2 = role("node2")

  class Ponger extends Actor {
    def receive = {
      case "ping" => sender ! "pong"
    }
  }
}

MultiNodeExampleSpecMultiJvmNode1.scala
class MultiNodeExampleSpecMultiJvmNode1 extends TestMultiNodeExample

MultiNodeExampleSpecMultiJvmNode2.scala
class MultiNodeExampleSpecMultiJvmNode2 extends TestMultiNodeExample

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to