This is an automated email from the ASF dual-hosted git repository.

cbickel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new a8434b7  Check all testfiles to actually contain the `RunWith` 
annotation. (#3290)
a8434b7 is described below

commit a8434b7c3eccaa5b4627849ce3cbff78dc67b41e
Author: Markus Thömmes <markusthoem...@me.com>
AuthorDate: Fri Feb 16 10:14:53 2018 +0100

    Check all testfiles to actually contain the `RunWith` annotation. (#3290)
    
    We had a couple of rogue tests in the repository which didn't have the 
annotation `RunWith`, so they haven't been run in CI/CD at all.
---
 .../{JsonArgsForTests.scala => TestJsonArgs.scala} |  2 +-
 .../whisk/core/cli/test/WskBasicUsageTests.scala   |  2 +-
 .../loadBalancer/test/LoadBalancerDataTests.scala  |  3 ++
 ...iderTest.scala => SeedNodesProviderTests.scala} |  7 ++--
 .../loadBalancer/test/SharedDataServiceTests.scala | 40 ++++++++--------------
 tools/travis/build.sh                              |  9 +++++
 6 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/tests/src/test/scala/whisk/core/cli/test/JsonArgsForTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/TestJsonArgs.scala
similarity index 99%
rename from tests/src/test/scala/whisk/core/cli/test/JsonArgsForTests.scala
rename to tests/src/test/scala/whisk/core/cli/test/TestJsonArgs.scala
index 9d8910e..474e820 100644
--- a/tests/src/test/scala/whisk/core/cli/test/JsonArgsForTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/TestJsonArgs.scala
@@ -23,7 +23,7 @@ import spray.json.JsString
 import spray.json.JsNumber
 import spray.json.JsBoolean
 
-object JsonArgsForTests {
+object TestJsonArgs {
 
   def getInvalidJSONInput =
     Seq(
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
index 970d569..925c098 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -45,7 +45,7 @@ import whisk.core.entity.LogLimit._
 import whisk.core.entity.MemoryLimit._
 import whisk.core.entity.TimeLimit._
 import whisk.core.entity.size.SizeInt
-import JsonArgsForTests._
+import TestJsonArgs._
 import whisk.http.Messages
 
 /**
diff --git 
a/tests/src/test/scala/whisk/core/loadBalancer/test/LoadBalancerDataTests.scala 
b/tests/src/test/scala/whisk/core/loadBalancer/test/LoadBalancerDataTests.scala
index 9afa67f..b60989a 100644
--- 
a/tests/src/test/scala/whisk/core/loadBalancer/test/LoadBalancerDataTests.scala
+++ 
b/tests/src/test/scala/whisk/core/loadBalancer/test/LoadBalancerDataTests.scala
@@ -21,6 +21,8 @@ import akka.actor.ActorSystem
 import akka.actor.Cancellable
 import com.typesafe.config.{ConfigFactory, ConfigValueFactory}
 import common.StreamLogging
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
 import org.scalatest.{FlatSpec, Matchers}
 import whisk.core.entity.{ActivationId, UUID, WhiskActivation}
 import whisk.core.loadBalancer.{ActivationEntry, DistributedLoadBalancerData, 
LocalLoadBalancerData}
@@ -30,6 +32,7 @@ import whisk.core.entity.InstanceId
 
 import scala.concurrent.duration._
 
+@RunWith(classOf[JUnitRunner])
 class LoadBalancerDataTests extends FlatSpec with Matchers with StreamLogging {
   final val emptyCancellable: Cancellable = new Cancellable {
     def isCancelled = false
diff --git 
a/tests/src/test/scala/whisk/core/loadBalancer/test/SeedNodesProviderTest.scala 
b/tests/src/test/scala/whisk/core/loadBalancer/test/SeedNodesProviderTests.scala
similarity index 91%
rename from 
tests/src/test/scala/whisk/core/loadBalancer/test/SeedNodesProviderTest.scala
rename to 
tests/src/test/scala/whisk/core/loadBalancer/test/SeedNodesProviderTests.scala
index 345c885..ef4ae85 100644
--- 
a/tests/src/test/scala/whisk/core/loadBalancer/test/SeedNodesProviderTest.scala
+++ 
b/tests/src/test/scala/whisk/core/loadBalancer/test/SeedNodesProviderTests.scala
@@ -18,10 +18,13 @@
 package whisk.core.loadBalancer.test
 
 import akka.actor.Address
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
 import org.scalatest.{FlatSpec, Matchers}
-import whisk.core.loadBalancer.{StaticSeedNodesProvider}
+import whisk.core.loadBalancer.StaticSeedNodesProvider
 
-class SeedNodesProviderTest extends FlatSpec with Matchers {
+@RunWith(classOf[JUnitRunner])
+class SeedNodesProviderTests extends FlatSpec with Matchers {
 
   val actorSystemName = "controller-actor-system"
   val host = "192.168.99.100"
diff --git 
a/tests/src/test/scala/whisk/core/loadBalancer/test/SharedDataServiceTests.scala
 
b/tests/src/test/scala/whisk/core/loadBalancer/test/SharedDataServiceTests.scala
index 3961e53..b3b37a7 100644
--- 
a/tests/src/test/scala/whisk/core/loadBalancer/test/SharedDataServiceTests.scala
+++ 
b/tests/src/test/scala/whisk/core/loadBalancer/test/SharedDataServiceTests.scala
@@ -20,27 +20,26 @@ package whisk.core.loadBalancer.test
 import akka.actor.ActorSystem
 import akka.testkit.{ImplicitSender, TestKit}
 import akka.util.Timeout
-import com.typesafe.config.ConfigValueFactory
-import com.typesafe.config.ConfigFactory
-import org.scalatest._
+import com.typesafe.config.{ConfigFactory, ConfigValueFactory}
+import org.junit.runner.RunWith
+import org.scalatest.{FlatSpecLike, _}
+import org.scalatest.junit.JUnitRunner
 import whisk.core.loadBalancer._
-import org.scalatest.FlatSpecLike
 
 import scala.concurrent.duration._
 
 // Define your test specific configuration here
 
 object TestKitConfig {
-  val config = """
-    akka.remote.netty.tcp {
-      hostname = "127.0.0.1"
-      port = 2555
-    }
-    """
+  val config = ConfigFactory.empty
+    .withValue("akka.remote.netty.tcp.hostname", 
ConfigValueFactory.fromAnyRef("127.0.0.1"))
+    .withValue("akka.remote.netty.tcp.port", 
ConfigValueFactory.fromAnyRef("2555"))
+    .withValue("akka.actor.provider", ConfigValueFactory.fromAnyRef("cluster"))
 }
 
+@RunWith(classOf[JUnitRunner])
 class SharedDataServiceTests()
-    extends TestKit(ActorSystem("ControllerCluster", 
ConfigFactory.parseString(TestKitConfig.config)))
+    extends TestKit(ActorSystem("ControllerCluster", TestKitConfig.config))
     with ImplicitSender
     with FlatSpecLike
     with Matchers
@@ -52,16 +51,7 @@ class SharedDataServiceTests()
 
   behavior of "SharedDataService"
 
-  val port = 2552
-  val host = "127.0.0.1"
-  val config = ConfigFactory
-    .parseString(s"akka.remote.netty.tcp.hostname=$host")
-    .withValue("akka.remote.netty.tcp.port", 
ConfigValueFactory.fromAnyRef(port))
-    .withValue("akka.actor.provider", ConfigValueFactory.fromAnyRef("cluster"))
-    .withFallback(ConfigFactory.load())
-
-  val s = ActorSystem("controller-actor-system", config)
-  val sharedDataService = s.actorOf(SharedDataService.props("Candidates"), 
name = "busyMan")
+  val sharedDataService = 
system.actorOf(SharedDataService.props("Candidates"), name = "busyMan")
   implicit val timeout = Timeout(5.seconds)
 
   it should "retrieve an empty map after initialization" in {
@@ -70,20 +60,20 @@ class SharedDataServiceTests()
     expectMsg(msg)
   }
   it should "increase the counter" in {
-    sharedDataService ! (IncreaseCounter("Donald", 1))
+    sharedDataService ! IncreaseCounter("Donald", 1)
     sharedDataService ! GetMap
     val msg = Map("Donald" -> 1)
     expectMsg(msg)
   }
   it should "decrease the counter" in {
-    sharedDataService ! (IncreaseCounter("Donald", 2))
-    sharedDataService ! (DecreaseCounter("Donald", 2))
+    sharedDataService ! IncreaseCounter("Donald", 2)
+    sharedDataService ! DecreaseCounter("Donald", 2)
     sharedDataService ! GetMap
     val msg = Map("Donald" -> 1)
     expectMsg(msg)
   }
   it should "receive the map with all counters" in {
-    sharedDataService ! (IncreaseCounter("Hilary", 1))
+    sharedDataService ! IncreaseCounter("Hilary", 1)
     sharedDataService ! GetMap
     val msg = Map("Hilary" -> 1, "Donald" -> 1)
     expectMsg(msg)
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 4870acb..c98285f 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -18,6 +18,15 @@ incubator-openwhisk-utilities/scancode/scanCode.py $ROOTDIR 
--config $ROOTDIR/to
 cd $ROOTDIR
 TERM=dumb ./gradlew checkScalafmtAll
 
+# lint tests to all be actually runnable
+MISSING_TESTS=$(grep -rL "RunWith" --include="*Tests.scala" tests)
+if [ -n "$MISSING_TESTS" ]
+then
+  echo "The following tests are missing the 'RunWith' annotation"
+  echo $MISSING_TESTS
+  exit 1
+fi
+
 cd $ROOTDIR/ansible
 
 ANSIBLE_CMD="ansible-playbook -i environments/local -e 
docker_image_prefix=testing"

-- 
To stop receiving notification emails like this one, please contact
cbic...@apache.org.

Reply via email to