Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase max-content-length to 50 MB #4059

Merged
merged 2 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/scala/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions tests/src/test/scala/common/WhiskProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chetanmeh, where is whisk.action.size.max set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently its not set and hence defaults to 10 MB. I wish to configure this (via system property) when we run system basic test against out setup with the max value that the cluster supports.

}

/**
* python interpreter.
*/
Expand Down Expand Up @@ -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) {
Expand Down
26 changes: 26 additions & 0 deletions tests/src/test/scala/system/basic/WskActionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._

Expand Down Expand Up @@ -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")
}
}

}