markusthoemmes commented on a change in pull request #2833: 
MesosContainerFactory
URL: 
https://github.com/apache/incubator-openwhisk/pull/2833#discussion_r169108345
 
 

 ##########
 File path: 
tests/src/test/scala/whisk/core/containerpool/mesos/test/MesosContainerFactoryTest.scala
 ##########
 @@ -0,0 +1,293 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.containerpool.mesos.test
+
+import akka.actor.ActorSystem
+import akka.stream.ActorMaterializer
+import akka.stream.scaladsl.Sink
+import akka.testkit.TestKit
+import akka.testkit.TestProbe
+import com.adobe.api.platform.runtime.mesos.Bridge
+import com.adobe.api.platform.runtime.mesos.DeleteTask
+import com.adobe.api.platform.runtime.mesos.Running
+import com.adobe.api.platform.runtime.mesos.SubmitTask
+import com.adobe.api.platform.runtime.mesos.Subscribe
+import com.adobe.api.platform.runtime.mesos.SubscribeComplete
+import com.adobe.api.platform.runtime.mesos.TaskDef
+import com.adobe.api.platform.runtime.mesos.User
+import com.typesafe.config.ConfigFactory
+import common.StreamLogging
+import org.apache.mesos.v1.Protos.AgentID
+import org.apache.mesos.v1.Protos.TaskID
+import org.apache.mesos.v1.Protos.TaskInfo
+import org.apache.mesos.v1.Protos.TaskState
+import org.apache.mesos.v1.Protos.TaskStatus
+import org.junit.runner.RunWith
+import org.scalatest.BeforeAndAfterEach
+import org.scalatest.FlatSpecLike
+import org.scalatest.Matchers
+import org.scalatest.junit.JUnitRunner
+import pureconfig.loadConfigOrThrow
+import scala.collection.immutable.Map
+import scala.concurrent.Await
+import scala.concurrent.Future
+import scala.concurrent.duration._
+import whisk.common.TransactionId
+import whisk.core.WhiskConfig
+import whisk.core.WhiskConfig._
+import whisk.core.containerpool.ContainerArgsConfig
+import whisk.core.containerpool.logging.DockerToActivationLogStore
+import whisk.core.entity.ExecManifest.ImageName
+import whisk.core.entity.size._
+import whisk.core.mesos.MesosConfig
+import whisk.core.mesos.MesosContainerFactory
+@RunWith(classOf[JUnitRunner])
+class MesosContainerFactoryTest
+    extends TestKit(ActorSystem("MesosActorSystem"))
+    with FlatSpecLike
+    with Matchers
+    with StreamLogging
+    with BeforeAndAfterEach {
+
+  /** Awaits the given future, throws the exception enclosed in Failure. */
+  def await[A](f: Future[A], timeout: FiniteDuration = 500.milliseconds) = 
Await.result[A](f, timeout)
+
+  implicit val wskConfig =
+    new WhiskConfig(Map(invokerCoreShare -> "2", dockerImageTag -> "latest", 
wskApiHostname -> "apihost") ++ wskApiHost)
+  var count = 0
+  var lastTaskId: String = null
+  def testTaskId() = {
+    count += 1
+    lastTaskId = "testTaskId" + count
+    lastTaskId
+  }
+
+  //TODO: adjust this once the invokerCoreShare issue is fixed see #3110
+  def cpus() = wskConfig.invokerCoreShare.toInt / 1024.0 //
+
+  val containerArgsConfig =
+    new ContainerArgsConfig("net1", Seq("dns1", "dns2"), Map("extra1" -> 
Set("e1", "e2"), "extra2" -> Set("e3", "e4")))
+
+  override def beforeEach() = {
+    stream.reset()
+  }
+  behavior of "MesosContainerFactory"
+
+  it should "send Subscribe on init" in {
+    val wskConfig = new WhiskConfig(Map())
+    val config = """
+    master-url: "http://master:5050";
+    """
+    val mesosConfig = 
loadConfigOrThrow[MesosConfig](ConfigFactory.parseString(config))
 
 Review comment:
   Why not construct the config yourself? (true for all tests)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to