Skip to content

Commit 4c97dc1

Browse files
Fix slight compilation differences between Scala 2.12 -> 2.13. (#4847)
1 parent 771a310 commit 4c97dc1

File tree

10 files changed

+31
-31
lines changed

10 files changed

+31
-31
lines changed

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,8 @@ class ContainerProxy(factory: (TransactionId,
701701
case data: WarmedData =>
702702
Future.successful(None)
703703
case _ =>
704-
val owEnv = (authEnvironment ++ environment + ("deadline" -> (Instant.now.toEpochMilli + actionTimeout.toMillis).toString.toJson)) map {
704+
val owEnv = (authEnvironment ++ environment ++ Map(
705+
"deadline" -> (Instant.now.toEpochMilli + actionTimeout.toMillis).toString.toJson)) map {
705706
case (key, value) => "__OW_" + key.toUpperCase -> value
706707
}
707708

core/standalone/src/main/scala/org/apache/openwhisk/standalone/StandaloneDockerSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class StandaloneDockerClient(pullDisabled: Boolean)(implicit log: Logging, as: A
204204
with WindowsDockerClient {
205205

206206
override def pull(image: String)(implicit transid: TransactionId): Future[Unit] = {
207-
if (pullDisabled) Future.successful(Unit) else super.pull(image)
207+
if (pullDisabled) Future.successful(()) else super.pull(image)
208208
}
209209

210210
override def runCmd(args: Seq[String], timeout: Duration)(implicit transid: TransactionId): Future[String] =

tests/src/test/scala/common/RunCliCmd.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ trait RunCliCmd extends Matchers {
7575
params.filter(s =>
7676
!s.equals("--auth") && !(params.indexOf(s) > 0 && params(params.indexOf(s) - 1).equals("--auth")))
7777
}
78-
if (showCmd) println(args.mkString(" ") + " " + finalParams.mkString(" "))
78+
args.appendAll(finalParams)
79+
if (showCmd) println(args.mkString(" "))
7980

80-
val rr = retry(
81-
0,
82-
retriesOnNetworkError,
83-
() => runCmd(DONTCARE_EXIT, workingDir, sys.env ++ env, stdinFile, args ++ finalParams))
81+
val rr =
82+
retry(0, retriesOnNetworkError, () => runCmd(DONTCARE_EXIT, workingDir, sys.env ++ env, stdinFile, args.toSeq))
8483

85-
withClue(hideStr(reportFailure(args ++ finalParams, expectedExitCode, rr).toString(), hideFromOutput)) {
84+
withClue(hideStr(reportFailure(args, expectedExitCode, rr).toString(), hideFromOutput)) {
8685
if (expectedExitCode != TestUtils.DONTCARE_EXIT) {
8786
val ok = (rr.exitCode == expectedExitCode) || (expectedExitCode == TestUtils.ANY_ERROR_EXIT && rr.exitCode != 0)
8887
if (!ok) {

tests/src/test/scala/common/rest/SwaggerValidator.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ trait SwaggerValidator {
106106
.asScala
107107
.filter(m => m.getLevel == ValidationReport.Level.ERROR)
108108
.map(_.toString)
109+
.toSeq
109110
}
110111

111112
def strictEntityBodyAsString(entity: HttpEntity): String = entity match {

tests/src/test/scala/org/apache/openwhisk/common/SchedulerTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class SchedulerTests extends FlatSpec with Matchers with WskActorSystem with Str
9898
waitForCalls()
9999
scheduled ! PoisonPill
100100

101-
val differences = calculateDifferences(calls)
101+
val differences = calculateDifferences(calls.toSeq)
102102
withClue(s"expecting all $differences to be >= $timeBetweenCalls") {
103103
differences.forall(_ >= timeBetweenCalls)
104104
}
@@ -158,7 +158,7 @@ class SchedulerTests extends FlatSpec with Matchers with WskActorSystem with Str
158158
waitForCalls(interval = timeBetweenCalls)
159159
scheduled ! PoisonPill
160160

161-
val differences = calculateDifferences(calls)
161+
val differences = calculateDifferences(calls.toSeq)
162162
withClue(s"expecting all $differences to be <= $timeBetweenCalls") {
163163
differences should not be 'empty
164164
differences.forall(_ <= timeBetweenCalls + schedulerSlack)
@@ -221,7 +221,7 @@ class SchedulerTests extends FlatSpec with Matchers with WskActorSystem with Str
221221
waitForCalls(interval = timeBetweenCalls)
222222
scheduled ! PoisonPill
223223

224-
val differences = calculateDifferences(calls)
224+
val differences = calculateDifferences(calls.toSeq)
225225
withClue(s"expecting all $differences to be <= $computationTime") {
226226
differences should not be 'empty
227227
differences.forall(_ <= computationTime + schedulerSlack)

tests/src/test/scala/org/apache/openwhisk/core/containerpool/docker/test/DockerContainerFactoryTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class DockerContainerFactoryTests
119119
(dockerApiStub
120120
.rm(_: ContainerId)(_: TransactionId))
121121
.expects(ContainerId("fakecontainerid"), *)
122-
.returning(Future.successful(Unit))
122+
.returning(Future.successful(()))
123123
//setup clientVersion exceptation
124124
(dockerApiStub.clientVersion _)
125125
.expects()

tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerProxyTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class ContainerProxyTests
263263
}
264264

265265
def createCollector(response: Future[ActivationLogs] = Future.successful(ActivationLogs()),
266-
invokeCallback: () => Unit = () => Unit) =
266+
invokeCallback: () => Unit = () => ()) =
267267
new LoggedCollector(response, invokeCallback)
268268

269269
def createStore = LoggedFunction { (transid: TransactionId, activation: WhiskActivation, context: UserContext) =>

tests/src/test/scala/org/apache/openwhisk/core/controller/test/PackagesApiTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ class PackagesApiTests extends ControllerTestCommon with WhiskPackagesApi {
293293
Get(s"$collectionPath/${provider.name}") ~> Route.seal(routes(creds)) ~> check {
294294
status should be(OK)
295295
val response = responseAs[WhiskPackageWithActions]
296-
response should be(provider withActions ())
296+
response should be(provider.withActions())
297297
}
298298
}
299299

@@ -308,7 +308,7 @@ class PackagesApiTests extends ControllerTestCommon with WhiskPackagesApi {
308308
Get(s"$collectionPath/${provider.name}") ~> Route.seal(routes(creds)) ~> check {
309309
status should be(OK)
310310
val response = responseAs[WhiskPackageWithActions]
311-
response should be(provider copy (updated = pkg.updated) withActions ())
311+
response should be(provider.copy(updated = pkg.updated).withActions())
312312
}
313313
}
314314

@@ -321,7 +321,7 @@ class PackagesApiTests extends ControllerTestCommon with WhiskPackagesApi {
321321
Get(s"$collectionPath/${reference.name}") ~> Route.seal(routes(creds)) ~> check {
322322
status should be(OK)
323323
val response = responseAs[WhiskPackageWithActions]
324-
response should be(reference inherit provider.parameters withActions ())
324+
response should be(reference.inherit(provider.parameters).withActions())
325325
// this is redundant in case the precedence orders on inherit are changed incorrectly
326326
response.wp.parameters should be(Parameters("a", "A") ++ Parameters("b", "b") ++ Parameters("c", "C"))
327327
}

tests/src/test/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBSupportTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class CosmosDBSupportTests
108108

109109
private def newMapper(paths: Set[String]) = {
110110
val mapper = stub[CosmosDBViewMapper]
111-
mapper.indexingPolicy _ when () returns newTestIndexingPolicy(paths)
111+
(mapper.indexingPolicy _).when().returns(newTestIndexingPolicy(paths))
112112
mapper
113113
}
114114

tests/src/test/scala/org/apache/openwhisk/core/database/test/CouchDbRestClientTests.scala

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import org.junit.runner.RunWith
2727
import org.scalatest.BeforeAndAfterAll
2828
import org.scalatest.FlatSpec
2929
import org.scalatest.Matchers
30-
import org.scalatest.concurrent.PatienceConfiguration.Timeout
3130
import org.scalatest.concurrent.ScalaFutures
3231
import org.scalatest.junit.JUnitRunner
3332
import akka.actor.Props
@@ -190,21 +189,21 @@ class CouchDbRestClientTests
190189
val futures: Vector[Future[Try[Either[StatusCode, JsObject]]]] =
191190
promises.map(_.future.map(e => Success(e)).recover { case t: Throwable => Failure(t) })
192191

193-
whenReady(Future.sequence(futures), Timeout(timeSpan * 2)) { results =>
194-
// We check that the first result was OK
195-
// (i.e. the service worked before the disruption)
196-
results.head.toOption shouldBe defined
197-
checkInstanceInfoResponse(results.head.get)
192+
val results = Await.result(Future.sequence(futures), timeSpan * 2)
198193

199-
// We check that the last result was OK
200-
// (i.e. the service worked again after the disruption)
201-
results.last.toOption shouldBe defined
202-
checkInstanceInfoResponse(results.last.get)
194+
// We check that the first result was OK
195+
// (i.e. the service worked before the disruption)
196+
results.head.toOption shouldBe defined
197+
checkInstanceInfoResponse(results.head.get)
203198

204-
// We check that there was at least one error
205-
// (i.e. we did manage to unbind for a while)
206-
results.find(_.isFailure) shouldBe defined
207-
}
199+
// We check that the last result was OK
200+
// (i.e. the service worked again after the disruption)
201+
results.last.toOption shouldBe defined
202+
checkInstanceInfoResponse(results.last.get)
203+
204+
// We check that there was at least one error
205+
// (i.e. we did manage to unbind for a while)
206+
results.find(_.isFailure) shouldBe defined
208207
}
209208

210209
it should "upload then download an attachment" in {

0 commit comments

Comments
 (0)