You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/06 18:32:49 UTC

[GitHub] rabbah closed pull request #14: refactor large input tests to include perl and python

rabbah closed pull request #14: refactor large input tests to include perl and python
URL: https://github.com/apache/incubator-openwhisk-runtime-docker/pull/14
 
 
   

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/core/CHANGELOG.md b/core/CHANGELOG.md
new file mode 100644
index 0000000..5a7cc54
--- /dev/null
+++ b/core/CHANGELOG.md
@@ -0,0 +1,11 @@
+# Apache OpenWhisk Docker Runtime Container
+
+
+## 1.1.0
+Changes:
+  - Allow input parameter larger than 128KB
+  - Added perl language support
+  - Added utilties jq, zip, git
+
+## 1.0.0
+Initial version
diff --git a/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala b/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala
index 80109bc..f496b76 100644
--- a/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala
+++ b/tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala
@@ -125,6 +125,31 @@ class ActionProxyContainerTests extends BasicActionRunnerTests with WskActorSyst
     Seq(("bash", bash), ("python", python), ("perl", perl))
   }
 
+  /** Large param samples, echo the input args with input larger than 128K and using STDIN */
+  val stdLargeInputSamples = {
+    val bash = """
+                 |#!/bin/bash
+                 |  read inputstring
+                 |  echo $inputstring
+                 """.stripMargin.trim
+
+    val python = """
+                   |#!/usr/bin/env python
+                   |import sys, json
+                   |params = sys.stdin.readline()
+                   |j = json.loads(params)
+                   |print(json.dumps(j))
+                 """.stripMargin.trim
+
+    val perl = """
+                 |#!/usr/bin/env perl
+                 |$params=<STDIN>;
+                 |print $params;
+               """.stripMargin.trim
+
+    Seq(("bash", bash), ("python", python), ("perl", perl))
+  }
+
   behavior of "openwhisk/dockerskeleton"
 
   it should "run sample without init" in {
@@ -219,6 +244,7 @@ class ActionProxyContainerTests extends BasicActionRunnerTests with WskActorSyst
   testEcho(stdCodeSamples)
   testUnicode(stdUnicodeSamples)
   testEnv(stdEnvSamples)
+  testLargeInput(stdLargeInputSamples)
 }
 
 trait BasicActionRunnerTests extends ActionProxyContainerTestUtils {
@@ -344,21 +370,22 @@ trait BasicActionRunnerTests extends ActionProxyContainerTestUtils {
     }
   }
 
-  it should "receive a large (1MB) argument" in {
-    withActionContainer() { c =>
-      val code = """
-                   |#!/bin/bash
-                   |  read inputstring
-                   |  echo $inputstring
-                   |
-                 """.stripMargin.trim
+  /**
+   * Large param samples, echo the input args with input larger than 128K and using STDIN
+   */
+  def testLargeInput(stdLargeInputSamples: Seq[(String, String)]) = {
+    stdLargeInputSamples.foreach { s =>
+      it should s"run a ${s._1} script with large input" in {
+        val (out, err) = withActionContainer() { c =>
+          val (initCode, _) = c.init(initPayload(s._2))
+          initCode should be(200)
 
-      val (initCode, initRes) = c.init(initPayload(code))
-      initCode should be(200)
+          val arg = JsObject("arg" -> JsString(("a" * 1048561)))
+          val (_, runRes) = c.run(runPayload(arg))
+          runRes.get shouldBe arg
+        }
 
-      val arg = JsObject("arg" -> JsString(("a" * 1048561)))
-      val (_, runRes) = c.run(runPayload(arg))
-      runRes.get shouldBe arg
+      }
     }
   }
 


 

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