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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4c97dc1  Fix slight compilation differences between Scala 2.12 -> 
2.13. (#4847)
4c97dc1 is described below

commit 4c97dc1a5a0591897ba5020f127fcd3d8df609f4
Author: Markus Thömmes <markusthoem...@me.com>
AuthorDate: Tue Mar 3 13:40:24 2020 +0100

    Fix slight compilation differences between Scala 2.12 -> 2.13. (#4847)
---
 .../core/containerpool/ContainerProxy.scala        |  3 ++-
 .../standalone/StandaloneDockerSupport.scala       |  2 +-
 tests/src/test/scala/common/RunCliCmd.scala        | 11 ++++-----
 .../test/scala/common/rest/SwaggerValidator.scala  |  1 +
 .../apache/openwhisk/common/SchedulerTests.scala   |  6 ++---
 .../docker/test/DockerContainerFactoryTests.scala  |  2 +-
 .../containerpool/test/ContainerProxyTests.scala   |  2 +-
 .../core/controller/test/PackagesApiTests.scala    |  6 ++---
 .../database/cosmosdb/CosmosDBSupportTests.scala   |  2 +-
 .../database/test/CouchDbRestClientTests.scala     | 27 +++++++++++-----------
 10 files changed, 31 insertions(+), 31 deletions(-)

diff --git 
a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
 
b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
index dae6895..0058996 100644
--- 
a/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
+++ 
b/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala
@@ -701,7 +701,8 @@ class ContainerProxy(factory: (TransactionId,
       case data: WarmedData =>
         Future.successful(None)
       case _ =>
-        val owEnv = (authEnvironment ++ environment + ("deadline" -> 
(Instant.now.toEpochMilli + actionTimeout.toMillis).toString.toJson)) map {
+        val owEnv = (authEnvironment ++ environment ++ Map(
+          "deadline" -> (Instant.now.toEpochMilli + 
actionTimeout.toMillis).toString.toJson)) map {
           case (key, value) => "__OW_" + key.toUpperCase -> value
         }
 
diff --git 
a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneDockerSupport.scala
 
b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneDockerSupport.scala
index 8b6eb5b..3a667d8 100644
--- 
a/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneDockerSupport.scala
+++ 
b/core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneDockerSupport.scala
@@ -204,7 +204,7 @@ class StandaloneDockerClient(pullDisabled: 
Boolean)(implicit log: Logging, as: A
     with WindowsDockerClient {
 
   override def pull(image: String)(implicit transid: TransactionId): 
Future[Unit] = {
-    if (pullDisabled) Future.successful(Unit) else super.pull(image)
+    if (pullDisabled) Future.successful(()) else super.pull(image)
   }
 
   override def runCmd(args: Seq[String], timeout: Duration)(implicit transid: 
TransactionId): Future[String] =
diff --git a/tests/src/test/scala/common/RunCliCmd.scala 
b/tests/src/test/scala/common/RunCliCmd.scala
index 67a4264..51b2572 100644
--- a/tests/src/test/scala/common/RunCliCmd.scala
+++ b/tests/src/test/scala/common/RunCliCmd.scala
@@ -75,14 +75,13 @@ trait RunCliCmd extends Matchers {
       params.filter(s =>
         !s.equals("--auth") && !(params.indexOf(s) > 0 && 
params(params.indexOf(s) - 1).equals("--auth")))
     }
-    if (showCmd) println(args.mkString(" ") + " " + finalParams.mkString(" "))
+    args.appendAll(finalParams)
+    if (showCmd) println(args.mkString(" "))
 
-    val rr = retry(
-      0,
-      retriesOnNetworkError,
-      () => runCmd(DONTCARE_EXIT, workingDir, sys.env ++ env, stdinFile, args 
++ finalParams))
+    val rr =
+      retry(0, retriesOnNetworkError, () => runCmd(DONTCARE_EXIT, workingDir, 
sys.env ++ env, stdinFile, args.toSeq))
 
-    withClue(hideStr(reportFailure(args ++ finalParams, expectedExitCode, 
rr).toString(), hideFromOutput)) {
+    withClue(hideStr(reportFailure(args, expectedExitCode, rr).toString(), 
hideFromOutput)) {
       if (expectedExitCode != TestUtils.DONTCARE_EXIT) {
         val ok = (rr.exitCode == expectedExitCode) || (expectedExitCode == 
TestUtils.ANY_ERROR_EXIT && rr.exitCode != 0)
         if (!ok) {
diff --git a/tests/src/test/scala/common/rest/SwaggerValidator.scala 
b/tests/src/test/scala/common/rest/SwaggerValidator.scala
index aaf7531..1f1a6f6 100644
--- a/tests/src/test/scala/common/rest/SwaggerValidator.scala
+++ b/tests/src/test/scala/common/rest/SwaggerValidator.scala
@@ -106,6 +106,7 @@ trait SwaggerValidator {
       .asScala
       .filter(m => m.getLevel == ValidationReport.Level.ERROR)
       .map(_.toString)
+      .toSeq
   }
 
   def strictEntityBodyAsString(entity: HttpEntity): String = entity match {
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/common/SchedulerTests.scala 
b/tests/src/test/scala/org/apache/openwhisk/common/SchedulerTests.scala
index d620486..e86a9e8 100644
--- a/tests/src/test/scala/org/apache/openwhisk/common/SchedulerTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/common/SchedulerTests.scala
@@ -98,7 +98,7 @@ class SchedulerTests extends FlatSpec with Matchers with 
WskActorSystem with Str
     waitForCalls()
     scheduled ! PoisonPill
 
-    val differences = calculateDifferences(calls)
+    val differences = calculateDifferences(calls.toSeq)
     withClue(s"expecting all $differences to be >= $timeBetweenCalls") {
       differences.forall(_ >= timeBetweenCalls)
     }
@@ -158,7 +158,7 @@ class SchedulerTests extends FlatSpec with Matchers with 
WskActorSystem with Str
     waitForCalls(interval = timeBetweenCalls)
     scheduled ! PoisonPill
 
-    val differences = calculateDifferences(calls)
+    val differences = calculateDifferences(calls.toSeq)
     withClue(s"expecting all $differences to be <= $timeBetweenCalls") {
       differences should not be 'empty
       differences.forall(_ <= timeBetweenCalls + schedulerSlack)
@@ -221,7 +221,7 @@ class SchedulerTests extends FlatSpec with Matchers with 
WskActorSystem with Str
     waitForCalls(interval = timeBetweenCalls)
     scheduled ! PoisonPill
 
-    val differences = calculateDifferences(calls)
+    val differences = calculateDifferences(calls.toSeq)
     withClue(s"expecting all $differences to be <= $computationTime") {
       differences should not be 'empty
       differences.forall(_ <= computationTime + schedulerSlack)
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
index 93ccefa..3e727f3 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala
@@ -119,7 +119,7 @@ class DockerContainerFactoryTests
     (dockerApiStub
       .rm(_: ContainerId)(_: TransactionId))
       .expects(ContainerId("fakecontainerid"), *)
-      .returning(Future.successful(Unit))
+      .returning(Future.successful(()))
     //setup clientVersion exceptation
     (dockerApiStub.clientVersion _)
       .expects()
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
index 519805e..d679690 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala
@@ -263,7 +263,7 @@ class ContainerProxyTests
   }
 
   def createCollector(response: Future[ActivationLogs] = 
Future.successful(ActivationLogs()),
-                      invokeCallback: () => Unit = () => Unit) =
+                      invokeCallback: () => Unit = () => ()) =
     new LoggedCollector(response, invokeCallback)
 
   def createStore = LoggedFunction { (transid: TransactionId, activation: 
WhiskActivation, context: UserContext) =>
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackagesApiTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackagesApiTests.scala
index 36ff016..e59121f 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackagesApiTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackagesApiTests.scala
@@ -293,7 +293,7 @@ class PackagesApiTests extends ControllerTestCommon with 
WhiskPackagesApi {
     Get(s"$collectionPath/${provider.name}") ~> Route.seal(routes(creds)) ~> 
check {
       status should be(OK)
       val response = responseAs[WhiskPackageWithActions]
-      response should be(provider withActions ())
+      response should be(provider.withActions())
     }
   }
 
@@ -308,7 +308,7 @@ class PackagesApiTests extends ControllerTestCommon with 
WhiskPackagesApi {
     Get(s"$collectionPath/${provider.name}") ~> Route.seal(routes(creds)) ~> 
check {
       status should be(OK)
       val response = responseAs[WhiskPackageWithActions]
-      response should be(provider copy (updated = pkg.updated) withActions ())
+      response should be(provider.copy(updated = pkg.updated).withActions())
     }
   }
 
@@ -321,7 +321,7 @@ class PackagesApiTests extends ControllerTestCommon with 
WhiskPackagesApi {
     Get(s"$collectionPath/${reference.name}") ~> Route.seal(routes(creds)) ~> 
check {
       status should be(OK)
       val response = responseAs[WhiskPackageWithActions]
-      response should be(reference inherit provider.parameters withActions ())
+      response should be(reference.inherit(provider.parameters).withActions())
       // this is redundant in case the precedence orders on inherit are 
changed incorrectly
       response.wp.parameters should be(Parameters("a", "A") ++ Parameters("b", 
"b") ++ Parameters("c", "C"))
     }
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBSupportTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBSupportTests.scala
index 2359e3d..6723e16 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBSupportTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBSupportTests.scala
@@ -108,7 +108,7 @@ class CosmosDBSupportTests
 
   private def newMapper(paths: Set[String]) = {
     val mapper = stub[CosmosDBViewMapper]
-    mapper.indexingPolicy _ when () returns newTestIndexingPolicy(paths)
+    (mapper.indexingPolicy _).when().returns(newTestIndexingPolicy(paths))
     mapper
   }
 
diff --git 
a/tests/src/test/scala/org/apache/openwhisk/core/database/test/CouchDbRestClientTests.scala
 
b/tests/src/test/scala/org/apache/openwhisk/core/database/test/CouchDbRestClientTests.scala
index c6b49a1..a29f3a2 100644
--- 
a/tests/src/test/scala/org/apache/openwhisk/core/database/test/CouchDbRestClientTests.scala
+++ 
b/tests/src/test/scala/org/apache/openwhisk/core/database/test/CouchDbRestClientTests.scala
@@ -27,7 +27,6 @@ import org.junit.runner.RunWith
 import org.scalatest.BeforeAndAfterAll
 import org.scalatest.FlatSpec
 import org.scalatest.Matchers
-import org.scalatest.concurrent.PatienceConfiguration.Timeout
 import org.scalatest.concurrent.ScalaFutures
 import org.scalatest.junit.JUnitRunner
 import akka.actor.Props
@@ -190,21 +189,21 @@ class CouchDbRestClientTests
     val futures: Vector[Future[Try[Either[StatusCode, JsObject]]]] =
       promises.map(_.future.map(e => Success(e)).recover { case t: Throwable 
=> Failure(t) })
 
-    whenReady(Future.sequence(futures), Timeout(timeSpan * 2)) { results =>
-      // We check that the first result was OK
-      // (i.e. the service worked before the disruption)
-      results.head.toOption shouldBe defined
-      checkInstanceInfoResponse(results.head.get)
+    val results = Await.result(Future.sequence(futures), timeSpan * 2)
 
-      // We check that the last result was OK
-      // (i.e. the service worked again after the disruption)
-      results.last.toOption shouldBe defined
-      checkInstanceInfoResponse(results.last.get)
+    // We check that the first result was OK
+    // (i.e. the service worked before the disruption)
+    results.head.toOption shouldBe defined
+    checkInstanceInfoResponse(results.head.get)
 
-      // We check that there was at least one error
-      // (i.e. we did manage to unbind for a while)
-      results.find(_.isFailure) shouldBe defined
-    }
+    // We check that the last result was OK
+    // (i.e. the service worked again after the disruption)
+    results.last.toOption shouldBe defined
+    checkInstanceInfoResponse(results.last.get)
+
+    // We check that there was at least one error
+    // (i.e. we did manage to unbind for a while)
+    results.find(_.isFailure) shouldBe defined
   }
 
   it should "upload then download an attachment" in {

Reply via email to