This is an automated email from the ASF dual-hosted git repository. vvraskin 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 b44188f re-enable system test without enabled concurrency (#4125) b44188f is described below commit b44188ff3121b16963b2c9e657625930cc634ec2 Author: Martin Henke <martin.he...@web.de> AuthorDate: Tue Nov 20 15:45:41 2018 +0100 re-enable system test without enabled concurrency (#4125) Run system tests with concurrency 1 if action concurrency is disabled. --- ansible/templates/whisk.properties.j2 | 2 ++ tests/dat/actions/concurrent.js | 2 +- .../core/containerpool/test/ContainerPoolTests.scala | 6 +++--- .../core/containerpool/test/ContainerProxyTests.scala | 11 ++++++++--- .../org/apache/openwhisk/core/limits/ActionLimitsTests.scala | 8 +++++++- .../org/apache/openwhisk/core/limits/ConcurrencyTests.scala | 11 ++++++----- .../test/ShardingContainerPoolBalancerTests.scala | 7 +++++-- 7 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ansible/templates/whisk.properties.j2 b/ansible/templates/whisk.properties.j2 index 6b79896..e946008 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 786efa2..c95a59b 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 3ef685c..5e65e4c 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 9ce7d09..d61cb84 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 feba31e..eb10f6e 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 d7b4171..458f1a2 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 0e91267..0c24b31 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(