No Tests to run for MultiJvm

81 views
Skip to first unread message

Harit Himanshu

unread,
Oct 18, 2015, 1:18:08 AM10/18/15
to Akka User List
Hello everyone,

I started learning akka-cluster today and was trying to write the multi-ivm test.
I followed all through the document but when I run my application, I see


> ; reload ; clean ; compile ; multi-jvm:test
[info] Loading project definition from /Users/harit/IdeaProjects/libs/akka-cluster-investigation/project
[info] Set current project to akka-cluster-investigation (in build file:/Users/harit/IdeaProjects/libs/akka-cluster-investigation/)
[success] Total time: 0 s, completed Oct 17, 2015 10:08:45 PM
[info] Updating {file:/Users/harit/IdeaProjects/libs/akka-cluster-investigation/}akka-cluster-investigation...
[info] Updating {file:/Users/harit/IdeaProjects/libs/akka-cluster-investigation/}cluster_simple...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 2 Scala sources to /Users/harit/IdeaProjects/libs/akka-cluster-investigation/cluster_simple/target/scala-2.11/classes...
[success] Total time: 1 s, completed Oct 17, 2015 10:08:46 PM
[info] Compiling 1 Scala source to /Users/harit/IdeaProjects/libs/akka-cluster-investigation/cluster_simple/target/scala-2.11/multi-jvm-classes...
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for MultiJvm
[success] Total time: 1 s, completed Oct 17, 2015 10:08:47 PM



It compiles the class but says no tests to run, My Test looks like  

import akka.remote.testkit.{MultiNodeConfig, MultiNodeSpec}
import akka.testkit.ImplicitSender
import org.scalatest.{BeforeAndAfterAll, MustMatchers, WordSpecLike}


object SimpleClusterListenerSpecConfig extends MultiNodeConfig {
val cluster = role("cluster")
}

class SimpleClusterListenerSpec extends MultiNodeSpec(SimpleClusterListenerSpecConfig)
with WordSpecLike
with MustMatchers
with BeforeAndAfterAll
with ImplicitSender {

import SimpleClusterListenerSpecConfig._

override def initialParticipants: Int = roles.size

"A SimpleClusterListener" must {
"wait for all nodes to enter a barrier" in {
enterBarrier("startup")
}

runOn(cluster) {
enterBarrier("deployed")
val clusterSelection = system.actorSelection(node(cluster) / "user" / "clusterListener")
clusterSelection ! Hello
expectMsg("hello")
}
}

override def beforeAll() = multiNodeSpecBeforeAll()

override def afterAll() = multiNodeSpecAfterAll()
}


And the entire code is available on GitHub. I would really appreciate if some one could help me spot my issue here.

Thanks
+ Harit Himanshu

matheus...@gmail.com

unread,
Oct 18, 2015, 11:22:46 AM10/18/15
to Akka User List
You need create the node class:
class:

class SimpleClusterListenerSpec
MultiJvmNode1 extends SimpleClusterListenerSpec
class SimpleClusterListenerSpecMultiJvmNode2 extends SimpleClusterListenerSpec

The class name always created using format XXXMultiJvmNodeN and you create one class per node you want test

Harit Himanshu

unread,
Oct 19, 2015, 12:47:01 AM10/19/15
to Akka User List
Thank you friend, that worked well and I was able to run my first multi-ivm test. Here is what my test code looks like.

When I run it, I get

$ sbt clean compile test

[info] Loading project definition from /Users/harit/IdeaProjects/libs/akka-cluster-investigation/project

[info] Set current project to akka-cluster-investigation (in build file:/Users/harit/IdeaProjects/libs/akka-cluster-investigation/)

[success] Total time: 0 s, completed Oct 18, 2015 9:43:50 PM

[info] Updating {file:/Users/harit/IdeaProjects/libs/akka-cluster-investigation/}cluster_simple...

[info] Updating {file:/Users/harit/IdeaProjects/libs/akka-cluster-investigation/}akka-cluster-investigation...

[info] Resolving jline#jline;2.12.1 ...

[info] Done updating.

[info] Resolving jline#jline;2.12.1 ...

[info] Done updating.

[info] Compiling 2 Scala sources to /Users/harit/IdeaProjects/libs/akka-cluster-investigation/cluster_simple/target/scala-2.11/classes...

[success] Total time: 6 s, completed Oct 18, 2015 9:43:56 PM

[info] Compiling 1 Scala source to /Users/harit/IdeaProjects/libs/akka-cluster-investigation/cluster_simple/target/scala-2.11/multi-jvm-classes...

[info] * SimpleClusterListenerSpec

[JVM-1] Run starting. Expected test count is: 2

[JVM-1] SimpleClusterListenerSpecMultiJvmNode1:

[JVM-1] - Illustrate how to start-up a cluster

[JVM-1] - show that SimpleClusterListener receives message

[JVM-1] [WARN] [10/18/2015 21:44:01.571] [SimpleClusterListenerSpec-akka.actor.default-dispatcher-16] [akka://SimpleClusterListenerSpec/user/controller/127.0.0.1:53775-server1] received dead letter from Actor[akka://SimpleClusterListenerSpec/deadLetters]: ClientDisconnected

[JVM-1] Run completed in 1 second, 889 milliseconds.

[JVM-1] Total number of tests run: 2

[JVM-1] Suites: completed 1, aborted 0

[JVM-1] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0

[JVM-1] All tests passed.

[info] Run completed in 37 milliseconds.

[info] Total number of tests run: 0

[info] Suites: completed 0, aborted 0

[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0

[info] No tests were executed.

[success] Total time: 5 s, completed Oct 18, 2015 9:44:01 PM



Thank you again for your help
+ Harit
Reply all
Reply to author
Forward
0 new messages