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/10/12 10:48:51 UTC

[GitHub] rabbah closed pull request #4059: Increase max-content-length to 50 MB

rabbah closed pull request #4059: Increase max-content-length to 50 MB
URL: https://github.com/apache/incubator-openwhisk/pull/4059
 
 
   

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/common/scala/src/main/resources/application.conf b/common/scala/src/main/resources/application.conf
index 712b3efffa..a51e6246dc 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 c1a316cb8b..0d44d8cd60 100644
--- a/tests/src/test/scala/common/WhiskProperties.java
+++ b/tests/src/test/scala/common/WhiskProperties.java
@@ -349,6 +349,10 @@ public static boolean onLinux() {
         return osname.equalsIgnoreCase("linux");
     }
 
+    public static int getMaxActionSizeMB(){
+        return Integer.parseInt(getProperty("whisk.action.size.max", "10"));
+    }
+
     /**
      * python interpreter.
      */
@@ -397,6 +401,14 @@ private static boolean isWhiskPropertiesRequired() {
         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 a003a87dd0..6db4b220f8 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")
+    }
+  }
+
 }


 

----------------------------------------------------------------
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