This is an automated email from the ASF dual-hosted git repository.
japetrsn 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 1c6cc36 Use runtime tags specified in runtime manifest for
YARNContainerFactoryTests (#4305)
1c6cc36 is described below
commit 1c6cc362a0036b917ed66c190217036884fdb7c0
Author: James Dubee <[email protected]>
AuthorDate: Mon Feb 25 21:57:51 2019 -0500
Use runtime tags specified in runtime manifest for
YARNContainerFactoryTests (#4305)
* Look up runtime tag for YARN tests
* Scala formatting
---
.../yarn/test/YARNContainerFactoryTests.scala | 30 ++++++++--------------
.../openwhisk/core/entity/test/ExecHelpers.scala | 10 +++++---
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/yarn/test/YARNContainerFactoryTests.scala
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/yarn/test/YARNContainerFactoryTests.scala
index 26f9988..6619f6a 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/yarn/test/YARNContainerFactoryTests.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/yarn/test/YARNContainerFactoryTests.scala
@@ -19,12 +19,13 @@ package org.apache.openwhisk.core.containerpool.yarn.test
import akka.actor.ActorSystem
import akka.http.scaladsl.model.DateTime
-import org.apache.openwhisk.common.{PrintStreamLogging, TransactionId}
+import org.apache.openwhisk.common.TransactionId
import org.apache.openwhisk.core.WhiskConfig
import org.apache.openwhisk.core.WhiskConfig._
import org.apache.openwhisk.core.containerpool.ContainerArgsConfig
import org.apache.openwhisk.core.entity.ExecManifest.ImageName
import org.apache.openwhisk.core.entity.{ByteSize, ExecManifest,
InvokerInstanceId, SizeUnits}
+import org.apache.openwhisk.core.entity.test.ExecHelpers
import org.apache.openwhisk.core.yarn.{YARNConfig, YARNContainerFactory,
YARNRESTUtil, YARNTask}
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@@ -35,21 +36,11 @@ import scala.concurrent.Await
import scala.concurrent.duration._
@RunWith(classOf[JUnitRunner])
-class YARNContainerFactoryTests extends Suite with BeforeAndAfter with
FlatSpecLike {
-
+class YARNContainerFactoryTests extends Suite with BeforeAndAfter with
FlatSpecLike with ExecHelpers {
val images = Array(
- ImageName("nodejs6action", Option("openwhisk"), Option("latest")),
- ImageName("python3action", Option("openwhisk"), Option("latest")))
-
- val runtimes: String = "{\"runtimes\":{" +
-
"\"nodejs\":[{\"kind\":\"nodejs:6\",\"image\":{\"prefix\":\"openwhisk\",\"name\":\"nodejs6action\",\"tag\":\"latest\"}}],"
+
-
"\"python\":[{\"kind\":\"python:3\",\"image\":{\"prefix\":\"openwhisk\",\"name\":\"python3action\",\"tag\":\"latest\"}}]"
+
- "}}"
-
- implicit val logging: PrintStreamLogging = new PrintStreamLogging()
- implicit val whiskConfig: WhiskConfig = new WhiskConfig(
- Map(wskApiHostname -> "apihost", runtimesManifest -> runtimes) ++
wskApiHost)
-
+ ImageName("nodejs6action", Option("openwhisk"), imageTag("nodejs:6")),
+ ImageName("python3action", Option("openwhisk"), imageTag("python:3")))
+ val runtimes = ExecManifest.runtimesManifest.toJson.compactPrint
val containerArgsConfig =
new ContainerArgsConfig(
"net1",
@@ -57,7 +48,6 @@ class YARNContainerFactoryTests extends Suite with
BeforeAndAfter with FlatSpecL
Seq.empty,
Seq.empty,
Map("extra1" -> Set("e1", "e2"), "extra2" -> Set("e3", "e4")))
-
val yarnConfig =
YARNConfig(
"http://localhost:8088",
@@ -73,16 +63,16 @@ class YARNContainerFactoryTests extends Suite with
BeforeAndAfter with FlatSpecL
val instance1 = new InvokerInstanceId(1, Some("invoker1"), Some("invoker1"),
ByteSize(0, SizeUnits.BYTE))
val serviceName0 = yarnConfig.serviceName + "-0"
val serviceName1 = yarnConfig.serviceName + "-1"
+ val properties: Map[String, Set[String]] = Map[String, Set[String]]()
- //System.setProperty("java.security.auth.login.config", "~/login.conf")
- //System.setProperty("java.security.krb5.conf", "/etc/krb5.conf")
+ implicit val whiskConfig: WhiskConfig = new WhiskConfig(
+ Map(wskApiHostname -> "apihost", runtimesManifest -> runtimes) ++
wskApiHost)
- val properties: Map[String, Set[String]] = Map[String, Set[String]]()
ExecManifest.initialize(whiskConfig)
behavior of "YARNContainerFactory"
- it should "initalize correctly with zero containers" in {
+ it should "initialize correctly with zero containers" in {
val rm = new MockYARNRM(8088, 1000)
rm.start()
diff --git
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
index 190ee47..91d0003 100644
---
a/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
+++
b/tests/src/test/scala/org/apache/openwhisk/core/entity/test/ExecHelpers.scala
@@ -42,15 +42,17 @@ trait ExecHelpers extends Matchers with WskActorSystem with
StreamLogging {
private def attFmt[T: JsonFormat] = Attachments.serdes[T]
- protected def imagename(name: String) = {
+ protected def imageName(name: String) =
ExecManifest.runtimesManifest.runtimes.flatMap(_.versions).find(_.kind ==
name).get.image
- }
+
+ protected def imageTag(name: String) =
+ ExecManifest.runtimesManifest.runtimes.flatMap(_.versions).find(_.kind ==
name).get.image.tag
protected def js10Old(code: String, main: Option[String] = None) = {
CodeExecAsString(
RuntimeManifest(
NODEJS10,
- imagename(NODEJS10),
+ imageName(NODEJS10),
default = Some(true),
deprecated = Some(false),
stemCells = Some(List(StemCell(2, 256.MB)))),
@@ -73,7 +75,7 @@ trait ExecHelpers extends Matchers with WskActorSystem with
StreamLogging {
CodeExecMetaDataAsString(
RuntimeManifest(
NODEJS10,
- imagename(NODEJS10),
+ imageName(NODEJS10),
default = Some(true),
deprecated = Some(false),
stemCells = Some(List(StemCell(2, 256.MB)))),