rabbah closed pull request #4105: Change the order to run the Action Limits Tests URL: https://github.com/apache/incubator-openwhisk/pull/4105
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/tests/build.gradle b/tests/build.gradle index 648b112318..a51654f2f1 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -60,7 +60,7 @@ ext.testSets = [ "org/apache/openwhisk/core/admin/**", "org/apache/openwhisk/core/apigw/actions/test/**", "org/apache/openwhisk/core/cli/test/**", - "org/apache/openwhisk/core/limits/**", + "org/apache/openwhisk/core/actionlimits/**", "**/*CacheConcurrencyTests*", "**/*ControllerApiTests*", "org/apache/openwhisk/testEntities/**", @@ -68,7 +68,7 @@ ext.testSets = [ ], "REQUIRE_SYSTEM" : [ "includes" : [ - "org/apache/openwhisk/core/limits/**", + "org/apache/openwhisk/core/actionlimits/**", "org/apache/openwhisk/core/admin/**", "org/apache/openwhisk/core/cli/test/**", "org/apache/openwhisk/core/apigw/actions/test/**", diff --git a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/actionlimits/ActionLimitsTests.scala similarity index 99% rename from tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala rename to tests/src/test/scala/org/apache/openwhisk/core/actionlimits/ActionLimitsTests.scala index 3acafcc739..f5b97979b9 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/limits/ActionLimitsTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/actionlimits/ActionLimitsTests.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.openwhisk.core.limits +package org.apache.openwhisk.core.actionlimits import akka.http.scaladsl.model.StatusCodes.RequestEntityTooLarge import akka.http.scaladsl.model.StatusCodes.BadGateway @@ -178,6 +178,37 @@ class ActionLimitsTests extends TestHelpers with WskTestHelpers with WskActorSys } } + it should "be able to run a memory intensive actions" in withAssetCleaner(wskprops) { (wp, assetHelper) => + val name = "TestNodeJsInvokeHighMemory" + val allowedMemory = MemoryLimit.maxMemory + assetHelper.withCleaner(wsk.action, name, confirmDelete = true) { + val actionName = TestUtils.getTestActionFilename("memoryWithGC.js") + (action, _) => + action.create(name, Some(actionName), memory = Some(allowedMemory)) + } + // Don't try to allocate all the memory on invoking the action, as the maximum memory is set for the whole container + // and not only for the user action. + val run = wsk.action.invoke(name, Map("payload" -> (allowedMemory.toMB - 56).toJson)) + withActivation(wsk.activation, run) { response => + response.response.status shouldBe "success" + } + } + + it should "be aborted when exceeding its memory limits" in withAssetCleaner(wskprops) { (wp, assetHelper) => + val name = "TestNodeJsMemoryExceeding" + assetHelper.withCleaner(wsk.action, name, confirmDelete = true) { + val allowedMemory = 128.megabytes + val actionName = TestUtils.getTestActionFilename("memoryWithGC.js") + (action, _) => + action.create(name, Some(actionName), memory = Some(allowedMemory)) + } + + val run = wsk.action.invoke(name, Map("payload" -> 256.toJson)) + withActivation(wsk.activation, run) { + _.response.result.get.fields("error") shouldBe Messages.memoryExhausted.toJson + } + } + /** * Test an action that exceeds its specified time limit. Explicitly specify a rather low time * limit to keep the test's runtime short. Invoke an action that sleeps for the specified time @@ -411,35 +442,4 @@ class ActionLimitsTests extends TestHelpers with WskTestHelpers with WskActorSys } } } - - it should "be able to run a memory intensive actions" in withAssetCleaner(wskprops) { (wp, assetHelper) => - val name = "TestNodeJsInvokeHighMemory" - val allowedMemory = MemoryLimit.maxMemory - assetHelper.withCleaner(wsk.action, name, confirmDelete = true) { - val actionName = TestUtils.getTestActionFilename("memoryWithGC.js") - (action, _) => - action.create(name, Some(actionName), memory = Some(allowedMemory)) - } - // Don't try to allocate all the memory on invoking the action, as the maximum memory is set for the whole container - // and not only for the user action. - val run = wsk.action.invoke(name, Map("payload" -> (allowedMemory.toMB - 56).toJson)) - withActivation(wsk.activation, run) { response => - response.response.status shouldBe "success" - } - } - - it should "be aborted when exceeding its memory limits" in withAssetCleaner(wskprops) { (wp, assetHelper) => - val name = "TestNodeJsMemoryExceeding" - assetHelper.withCleaner(wsk.action, name, confirmDelete = true) { - val allowedMemory = 128.megabytes - val actionName = TestUtils.getTestActionFilename("memoryWithGC.js") - (action, _) => - action.create(name, Some(actionName), memory = Some(allowedMemory)) - } - - val run = wsk.action.invoke(name, Map("payload" -> 256.toJson)) - withActivation(wsk.activation, run) { - _.response.result.get.fields("error") shouldBe Messages.memoryExhausted.toJson - } - } } diff --git a/tests/src/test/scala/org/apache/openwhisk/core/limits/MaxActionDurationTests.scala b/tests/src/test/scala/org/apache/openwhisk/core/actionlimits/MaxActionDurationTests.scala similarity index 98% rename from tests/src/test/scala/org/apache/openwhisk/core/limits/MaxActionDurationTests.scala rename to tests/src/test/scala/org/apache/openwhisk/core/actionlimits/MaxActionDurationTests.scala index 14ad88294d..e124e92646 100644 --- a/tests/src/test/scala/org/apache/openwhisk/core/limits/MaxActionDurationTests.scala +++ b/tests/src/test/scala/org/apache/openwhisk/core/actionlimits/MaxActionDurationTests.scala @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.openwhisk.core.limits +package org.apache.openwhisk.core.actionlimits import scala.concurrent.duration.DurationInt ---------------------------------------------------------------- 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