Hi,

So for each test class in a multi-node test there is a separate jvm started 
with the corresponding class and a unique index property added with the " 
-Dmultinode.index=“. This is done automatically by the sbtMultiJvm plugin for 
sbt builds. For this to work with maven I assume that you would have to have a 
specialized test runner that starts multiple jvms and send in the correct 
parameters to the different jvm.

Another option is to write a script that starts the jvms with the correct 
parameters.

B/

On 10 March 2014 at 13:49:22, lee json ([email protected]) wrote:

Sorry maven doesn't even generate any logs to surefire-report.

$ls -alh target/surefire-reports
ls: cannot access target/surefire-reports: No such file or directory
$ls target/
classes  classes.timestamp  test-classes  test-classes.timestamp

What gets printed on console is as below (after test is reran)

[INFO] --- maven-surefire-plugin:2.6:test (default-test) @ remote-sample ---
[INFO] Surefire report directory: 
/path/to/multi-node-testing/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running samples.TestMultiNodeExample


Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.981 sec <<< 
FAILURE!
initializationError(samples.TestMultiNodeExample)  Time elapsed: 0.002 sec  <<< 
ERROR!
java.lang.RuntimeException: unexpected transition: 
Transition(Actor[akka://TestMultiNodeExample/user/TestConductorClient#1333224920],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)


Results :

Tests in error: 
  initializationError(samples.TestMultiNodeExample)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.232s
[INFO] Finished at: Mon Mar 10 19:55:49 CST 2014
[INFO] Final Memory: 6M/110M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.6:test (default-test) on 
project remote-sample: There are test failures.
 
Passing system property -Dmultinode.index=01 it throws unexpected transition 

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.99 sec <<< 
FAILURE!
initializationError(samples.TestMultiNodeExample)  Time elapsed: 0.002 sec  <<< 
ERROR!
java.lang.RuntimeException: unexpected transition: 
Transition(Actor[akka://TestMultiNodeExample/user/TestConductorClient#2062474926],Connecting,Failed)

Passing system property -Dmultinode.index=0,1 throws initializationError 

Running samples.TestMultiNodeExample
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.213 sec <<< 
FAILURE!
initializationError(samples.TestMultiNodeExample)  Time elapsed: 0.001 sec  <<< 
ERROR!
java.lang.ExceptionInInitializerError
at akka.remote.testkit.MultiNodeConfig.myself$lzycompute(MultiNodeSpec.scala:96)


Passing system property -Dmultinode.index=2 throws initializationError. 

Running samples.TestMultiNodeExample
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.256 sec <<< 
FAILURE!
initializationError(samples.TestMultiNodeExample)  Time elapsed: 0.001 sec  <<< 
ERROR!
java.lang.ExceptionInInitializerError
at akka.remote.testkit.MultiNodeConfig.myself$lzycompute(MultiNodeSpec.scala:96)


What is the correct format when passing values to multinode.index? 

I tried passing in -e -X, but don't know at which part to spot. Or any 
additional parameters/ steps I can try so to provide more information?

Version is Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 
2013-02-19 21:51:28+0800)

Thanks


On Monday, 10 March 2014 16:13:35 UTC+8, Björn Antonsson wrote:
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.
-- 
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