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 2022/07/25 02:38:16 UTC

[GitHub] [openwhisk-runtime-go] ningyougang commented on a diff in pull request #170: Support array result include sequence action

ningyougang commented on code in PR #170:
URL: https://github.com/apache/openwhisk-runtime-go/pull/170#discussion_r928367775


##########
tests/src/test/scala/runtime/actionContainers/ActionLoopGoContainerTests.scala:
##########
@@ -135,4 +135,27 @@ abstract class ActionLoopGoContainerTests
       c.run(helloMsg()) should be(okMsg("hello-Hello", "Hello, Demo!"))
     }
   }
+
+  it should "support return array result" in {
+    val helloArrayGo = {
+      s"""
+         |package main
+         |
+         |func Main(obj map[string]interface{}) []interface{} {
+         |    result := []interface{}{"a", "b"}
+         |    return result
+         |}
+         |
+       """.stripMargin
+    }
+    val src = ExeBuilder.mkBase64SrcZip(
+      Seq(
+        Seq(s"main.go") -> helloArrayGo
+      ))
+    withActionLoopContainer { c =>
+      c.init(initPayload(src))._1 shouldBe (200)
+      val result = c.run(JsObject())
+      result._1 shouldBe (200)

Review Comment:
   Nomally, the test case here should compare the result as well. e.g. 
   ```
       withActionLoopContainer { c =>
         c.init(initPayload(src))._1 shouldBe (200)
         val result = c.runForJsArray(JsObject())
         result._1 shouldBe (200)
         result._2.get.elements shouldBe Vector(JsString("a"), JsString("b"))
       }
   ```
   But `c.runForJsArray(JsObject())` depend on openwhisk and this method is implelment in this pr: https://github.com/apache/openwhisk/pull/5290/files#r926350523



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org