This is an automated email from the ASF dual-hosted git repository.
rabbah 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 4783c99 Increase max-content-length to 50 MB (#4059)
4783c99 is described below
commit 4783c998da56bb7ca9c6616b30de6f9950cfdbb3
Author: Chetan Mehrotra <[email protected]>
AuthorDate: Fri Oct 12 16:18:49 2018 +0530
Increase max-content-length to 50 MB (#4059)
---
common/scala/src/main/resources/application.conf | 1 +
tests/src/test/scala/common/WhiskProperties.java | 12 ++++++++++
.../test/scala/system/basic/WskActionTests.scala | 26 ++++++++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/common/scala/src/main/resources/application.conf
b/common/scala/src/main/resources/application.conf
index ba6324d..b7afb041 100644
--- a/common/scala/src/main/resources/application.conf
+++ b/common/scala/src/main/resources/application.conf
@@ -8,6 +8,7 @@ akka.http {
client {
parsing.illegal-header-warnings = off
parsing.max-chunk-size = 50m
+ parsing.max-content-length = 50m
}
host-connection-pool {
diff --git a/tests/src/test/scala/common/WhiskProperties.java
b/tests/src/test/scala/common/WhiskProperties.java
index c1a316c..0d44d8c 100644
--- a/tests/src/test/scala/common/WhiskProperties.java
+++ b/tests/src/test/scala/common/WhiskProperties.java
@@ -349,6 +349,10 @@ public class WhiskProperties {
return osname.equalsIgnoreCase("linux");
}
+ public static int getMaxActionSizeMB(){
+ return Integer.parseInt(getProperty("whisk.action.size.max", "10"));
+ }
+
/**
* python interpreter.
*/
@@ -397,6 +401,14 @@ public class WhiskProperties {
return getPropFromSystemOrEnv(WHISK_SERVER) == null;
}
+ private static String getProperty(String key, String defaultValue) {
+ String value = getPropFromSystemOrEnv(key);
+ if (value == null) {
+ value = whiskProperties.getProperty(key, defaultValue);
+ }
+ return value;
+ }
+
private static String getPropFromSystemOrEnv(String key) {
String value = System.getProperty(key);
if (value == null) {
diff --git a/tests/src/test/scala/system/basic/WskActionTests.scala
b/tests/src/test/scala/system/basic/WskActionTests.scala
index a003a87..6db4b22 100644
--- a/tests/src/test/scala/system/basic/WskActionTests.scala
+++ b/tests/src/test/scala/system/basic/WskActionTests.scala
@@ -17,10 +17,14 @@
package system.basic
+import java.io.File
+import java.nio.charset.StandardCharsets
+
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import common._
import common.rest.WskRestOperations
+import org.apache.commons.io.FileUtils
import spray.json._
import spray.json.DefaultJsonProtocol._
@@ -289,4 +293,26 @@ class WskActionTests extends TestHelpers with
WskTestHelpers with JsHelpers with
activation.logs.get.mkString(" ") should include(s"hello, $utf8")
}
}
+
+ it should "invoke action with large code" in withAssetCleaner(wskprops) {
(wp, assetHelper) =>
+ val name = "big-hello"
+ assetHelper.withCleaner(wsk.action, name) { (action, _) =>
+ val filePath = TestUtils.getTestActionFilename("hello.js")
+ val code = FileUtils.readFileToString(new File(filePath),
StandardCharsets.UTF_8)
+ val largeCode = code + " " * (WhiskProperties.getMaxActionSizeMB *
FileUtils.ONE_MB).toInt
+ val tmpFile = File.createTempFile("whisk", ".js")
+ FileUtils.write(tmpFile, largeCode, StandardCharsets.UTF_8)
+ val result = action.create(name, Some(tmpFile.getAbsolutePath))
+ tmpFile.delete()
+ result
+ }
+
+ val hello = "hello"
+ val run = wsk.action.invoke(name, Map("payload" -> hello.toJson))
+ withActivation(wsk.activation, run) { activation =>
+ activation.response.status shouldBe "success"
+ activation.logs.get.mkString(" ") should include(s"hello, $hello")
+ }
+ }
+
}