You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/07/23 15:12:52 UTC

[incubator-openwhisk-runtime-ruby] 14/19: Update tests to pick up upstream changes.

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-runtime-ruby.git

commit 6c003ce9418bdfe7c0ec5641f0c729f8c6509225
Author: Kei Sawada <k...@swd.cc>
AuthorDate: Sat Jul 14 23:38:44 2018 +0900

    Update tests to pick up upstream changes.
---
 .../Ruby25ActionContainerTests.scala               | 107 ++++++++++++++-------
 1 file changed, 70 insertions(+), 37 deletions(-)

diff --git a/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala b/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala
index 4605305..cd23809 100644
--- a/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala
+++ b/tests/src/test/scala/actionContainers/Ruby25ActionContainerTests.scala
@@ -40,55 +40,88 @@ class Ruby25ActionContainerTests extends BasicActionRunnerTests with WskActorSys
 
   behavior of ruby25ContainerImageName
 
-  testEcho(Seq {
-    (
-      "RUBY",
+  override val testNoSourceOrExec = TestConfig("")
+
+  override val testEcho = {
+    TestConfig("""
+                 |def main(args)
+                 |  puts 'hello stdout'
+                 |  warn 'hello stderr'
+                 |  args
+                 |end
+               """.stripMargin)
+  }
+
+  override val testNotReturningJson = {
+    TestConfig(
+      """
+       |def main(args)
+       |  "not a json object"
+       |end
+     """.stripMargin,
+      enforceEmptyOutputStream = enforceEmptyOutputStream,
+      enforceEmptyErrorStream = false)
+  }
+
+  override val testInitCannotBeCalledMoreThanOnce = {
+    TestConfig(
       """
-          |def main(args)
-          |  puts 'hello stdout'
-          |  warn 'hello stderr'
-          |  args
-          |end
-          """.stripMargin)
-  })
-
-  testNotReturningJson("""
         |def main(args)
-        |  "not a json object"
+        |  args
         |end
-        """.stripMargin)
+      """.stripMargin,
+      enforceEmptyOutputStream = enforceEmptyOutputStream)
+  }
 
-  testUnicode(Seq {
-    (
-      "RUBY",
+  override val testEntryPointOtherThanMain = {
+    TestConfig(
       """
+        |def niam(args)
+        |  args
+        |end
+      """.stripMargin,
+      main = "niam",
+      enforceEmptyOutputStream = enforceEmptyOutputStream)
+  }
+
+  override val testUnicode = {
+    TestConfig("""
          |def main(args)
          |  str = args['delimiter'] + " ☃ " + args['delimiter']
          |  print str + "\n"
          |  {"winter" => str}
          |end
          """.stripMargin.trim)
-  })
+  }
 
-  testEnv(
-    Seq {
-      (
-        "RUBY",
-        """
-         |def main(args)
-         |  {
-         |       "env" => ENV,
-         |       "api_host" => ENV['__OW_API_HOST'],
-         |       "api_key" => ENV['__OW_API_KEY'],
-         |       "namespace" => ENV['__OW_NAMESPACE'],
-         |       "action_name" => ENV['__OW_ACTION_NAME'],
-         |       "activation_id" => ENV['__OW_ACTIVATION_ID'],
-         |       "deadline" => ENV['__OW_DEADLINE']
-         |  }
-         |end
-         """.stripMargin.trim)
-    },
-    enforceEmptyOutputStream)
+  override val testEnv = {
+    TestConfig(
+      """
+        |def main(args)
+        |  {
+        |       "env" => ENV,
+        |       "api_host" => ENV['__OW_API_HOST'],
+        |       "api_key" => ENV['__OW_API_KEY'],
+        |       "namespace" => ENV['__OW_NAMESPACE'],
+        |       "action_name" => ENV['__OW_ACTION_NAME'],
+        |       "activation_id" => ENV['__OW_ACTIVATION_ID'],
+        |       "deadline" => ENV['__OW_DEADLINE']
+        |  }
+        |end
+      """.stripMargin.trim,
+      enforceEmptyOutputStream = enforceEmptyOutputStream)
+  }
+
+  override val testLargeInput = {
+    TestConfig("""
+        |<?php
+        |function main(array $args) : array {
+        |    echo 'hello stdout';
+        |    error_log('hello stderr');
+        |    return $args;
+        |}
+      """.stripMargin)
+  }
 
   it should "fail to initialize with bad code" in {
     val (out, err) = withRuby25Container { c =>