You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/11/20 14:45:43 UTC

[GitHub] vvraskin closed pull request #4125: Run system tests with concurrency 1 if action concurrency is disabled

vvraskin closed pull request #4125: Run system tests with concurrency 1 if action concurrency is disabled
URL: https://github.com/apache/incubator-openwhisk/pull/4125
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ansible/templates/whisk.properties.j2 b/ansible/templates/whisk.properties.j2
index 6b79896653..e946008c37 100644
--- a/ansible/templates/whisk.properties.j2
+++ b/ansible/templates/whisk.properties.j2
@@ -32,6 +32,8 @@ whisk.api.host.name={{ whisk_api_host_name | default(groups['edge'] | first) }}
 whisk.api.localhost.name={{ whisk_api_localhost_name | default(whisk_api_host_name) | default(whisk_api_localhost_name_default) }}
 whisk.api.vanity.subdomain.parts=1
 
+whisk.action.concurrency={{runtimes_enable_concurrency | default(false)}}
+
 runtimes.manifest={{ runtimesManifest | to_json }}
 
 limits.actions.invokes.perMinute={{ limits.invocationsPerMinute }}
diff --git a/tests/dat/actions/concurrent.js b/tests/dat/actions/concurrent.js
index 786efa2d65..c95a59b79e 100644
--- a/tests/dat/actions/concurrent.js
+++ b/tests/dat/actions/concurrent.js
@@ -36,4 +36,4 @@ function checkRequests(args, resolve, reject, elapsed) {
             }, interval);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerPoolTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerPoolTests.scala
index 3ef685cb38..5e65e4c08e 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerPoolTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerPoolTests.scala
@@ -21,7 +21,6 @@ import java.time.Instant
 
 import scala.collection.mutable
 import scala.concurrent.duration._
-
 import org.junit.runner.RunWith
 import org.scalamock.scalatest.MockFactory
 import org.scalatest.BeforeAndAfterAll
@@ -29,12 +28,12 @@ import org.scalatest.FlatSpec
 import org.scalatest.FlatSpecLike
 import org.scalatest.Matchers
 import org.scalatest.junit.JUnitRunner
-
 import akka.actor.ActorRefFactory
 import akka.actor.ActorSystem
 import akka.testkit.ImplicitSender
 import akka.testkit.TestKit
 import akka.testkit.TestProbe
+import common.WhiskProperties
 import org.apache.openwhisk.common.TransactionId
 import org.apache.openwhisk.core.connector.ActivationMessage
 import org.apache.openwhisk.core.containerpool._
@@ -571,7 +570,8 @@ class ContainerPoolObjectTests extends FlatSpec with Matchers with MockFactory {
   }
 
   it should "not use a container when active activation count >= maxconcurrent" in {
-    val maxConcurrent = 25
+    val concurrencyEnabled = Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+    val maxConcurrent = if (concurrencyEnabled) 25 else 1
 
     val data = warmedData(
       active = maxConcurrent,
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 9ce7d09e9e..d61cb84c38 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
@@ -18,14 +18,15 @@
 package org.apache.openwhisk.core.containerpool.test
 
 import java.time.Instant
+
 import akka.actor.FSM.{CurrentState, SubscribeTransitionCallBack, Transition}
 import akka.actor.{ActorRef, ActorSystem, FSM}
 import akka.stream.scaladsl.Source
 import akka.testkit.{ImplicitSender, TestKit}
 import akka.util.ByteString
-import common.SynchronizedLoggedFunction
-import common.{LoggedFunction, StreamLogging}
+import common.{LoggedFunction, StreamLogging, SynchronizedLoggedFunction, WhiskProperties}
 import java.util.concurrent.atomic.AtomicInteger
+
 import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 import org.scalatest.{BeforeAndAfterAll, FlatSpecLike, Matchers}
@@ -69,11 +70,13 @@ class ContainerProxyTests
 
   val invocationNamespace = EntityName("invocationSpace")
   val action = ExecutableWhiskAction(EntityPath("actionSpace"), EntityName("actionName"), exec)
+  val concurrencyEnabled = Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+  val testConcurrencyLimit = if (concurrencyEnabled) ConcurrencyLimit(2) else ConcurrencyLimit(1)
   val concurrentAction = ExecutableWhiskAction(
     EntityPath("actionSpace"),
     EntityName("actionName"),
     exec,
-    limits = ActionLimits(concurrency = ConcurrencyLimit(2)))
+    limits = ActionLimits(concurrency = testConcurrencyLimit))
 
   // create a transaction id to set the start time and control queue time
   val messageTransId = TransactionId(TransactionId.testing.meta.id)
@@ -460,6 +463,8 @@ class ContainerProxyTests
   //without waiting for the completion of the previous Run message (signaled by NeedWork message)
   //Multiple messages can only be handled after Warming.
   it should "stay in Running state if others are still running" in within(timeout) {
+    assume(Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean))
+
     val initPromise = Promise[Interval]()
     val runPromises = Seq(
       Promise[(Interval, ActivationResponse)](),
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
index feba31ee3f..eb10f6e07b 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala
@@ -125,12 +125,18 @@ class ActionLimitsTests extends TestHelpers with WskTestHelpers with WskActorSys
     val toExpectedResultString: String = if (ec == SUCCESS_EXIT) "allow" else "reject"
   }
 
+  val concurrencyEnabled = Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+
   val perms = { // Assert for valid permutations that the values are set correctly
     for {
       time <- Seq(None, Some(TimeLimit.MIN_DURATION), Some(TimeLimit.MAX_DURATION))
       mem <- Seq(None, Some(MemoryLimit.minMemory), Some(MemoryLimit.maxMemory))
       log <- Seq(None, Some(LogLimit.minLogSize), Some(LogLimit.maxLogSize))
-      concurrency <- Seq(None, Some(ConcurrencyLimit.minConcurrent), Some(ConcurrencyLimit.maxConcurrent))
+      concurrency <- if (!concurrencyEnabled || (ConcurrencyLimit.minConcurrent == ConcurrencyLimit.maxConcurrent)) {
+        Seq(None, Some(ConcurrencyLimit.minConcurrent))
+      } else {
+        Seq(None, Some(ConcurrencyLimit.minConcurrent), Some(ConcurrencyLimit.maxConcurrent))
+      }
     } yield PermutationTestParameter(time, mem, log, concurrency)
   } ++
     // Add variations for negative tests
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/limits/ConcurrencyTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/limits/ConcurrencyTests.scala
index d7b41716b3..458f1a2255 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/limits/ConcurrencyTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/limits/ConcurrencyTests.scala
@@ -17,11 +17,7 @@
 
 package org.apache.openwhisk.core.limits
 
-import common.TestHelpers
-import common.TestUtils
-import common.WskActorSystem
-import common.WskProps
-import common.WskTestHelpers
+import common._
 import common.rest.WskRestOperations
 import org.apache.openwhisk.core.ConfigKeys
 import org.apache.openwhisk.core.containerpool.ContainerPoolConfig
@@ -30,6 +26,7 @@ import org.apache.openwhisk.core.entity.size._
 import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 import pureconfig.loadConfigOrThrow
+
 import scala.concurrent.Await
 import scala.concurrent.Future
 import scala.concurrent.duration.DurationInt
@@ -55,6 +52,8 @@ class ConcurrencyTests extends TestHelpers with WskTestHelpers with WskActorSyst
 
   //This tests generates a concurrent load against the concurrent.js action with concurrency set to 5
   it should "execute activations concurrently when concurrency > 1 " in withAssetCleaner(wskprops) {
+    assume(Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean))
+
     (wp, assetHelper) =>
       val name = "TestConcurrentAction"
       assetHelper.withCleaner(wsk.action, name, confirmDelete = true) {
@@ -102,6 +101,8 @@ class ConcurrencyTests extends TestHelpers with WskTestHelpers with WskActorSyst
 
   //This tests generates the same load against the same action as previous test, BUT with concurrency set to 1
   it should "execute activations sequentially when concurrency = 1 " in withAssetCleaner(wskprops) {
+    assume(Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean))
+
     (wp, assetHelper) =>
       val name = "TestNonConcurrentAction"
       assetHelper.withCleaner(wsk.action, name, confirmDelete = true) {
diff --git a/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
index 0e91267760..0c24b318da 100644
--- a/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
+++ b/tests/src/test/scala/org/apache/openwhisk/core/loadBalancer/test/ShardingContainerPoolBalancerTests.scala
@@ -22,8 +22,9 @@ import akka.actor.ActorRefFactory
 import akka.actor.ActorSystem
 import akka.stream.ActorMaterializer
 import akka.testkit.TestProbe
-import common.StreamLogging
+import common.{StreamLogging, WhiskProperties}
 import java.nio.charset.StandardCharsets
+
 import org.apache.kafka.clients.producer.RecordMetadata
 import org.apache.kafka.common.TopicPartition
 import org.junit.runner.RunWith
@@ -31,6 +32,7 @@ import org.scalamock.scalatest.MockFactory
 import org.scalatest.junit.JUnitRunner
 import org.scalatest.FlatSpec
 import org.scalatest.Matchers
+
 import scala.concurrent.Await
 import scala.concurrent.Future
 import scala.concurrent.duration._
@@ -367,7 +369,8 @@ class ShardingContainerPoolBalancerTests
   implicit val am = ActorMaterializer()
   val config = new WhiskConfig(ExecManifest.requiredProperties)
   val invokerMem = 2000.MB
-  val concurrency = 5
+  val concurrencyEnabled = Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+  val concurrency = if (concurrencyEnabled) 5 else 1
   val actionMem = 256.MB
   val actionMetaData =
     WhiskActionMetaData(


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services