You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by dg...@apache.org on 2022/08/15 15:01:24 UTC
[openwhisk-runtime-php] branch master updated: Support array result include sequence action (#120)
This is an automated email from the ASF dual-hosted git repository.
dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-php.git
The following commit(s) were added to refs/heads/master by this push:
new c587ae4 Support array result include sequence action (#120)
c587ae4 is described below
commit c587ae4a1b64b38f878da02c322bffd717d63fcd
Author: ningyougang <41...@qq.com>
AuthorDate: Mon Aug 15 23:01:20 2022 +0800
Support array result include sequence action (#120)
---
core/php7.4Action/Dockerfile | 4 +-
core/php8.0Action/Dockerfile | 4 +-
.../Php7ActionContainerTests.scala | 45 ++++++++++++++++++++++
3 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/core/php7.4Action/Dockerfile b/core/php7.4Action/Dockerfile
index d0d7806..cda7f07 100644
--- a/core/php7.4Action/Dockerfile
+++ b/core/php7.4Action/Dockerfile
@@ -26,12 +26,12 @@ RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
# or build it from a release
FROM golang:1.18 AS builder_release
-ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
+ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
- && GO111MODULE=on go build -o /bin/proxy
+ && GO111MODULE=on GO111MODULE=on go build -o /bin/proxy
FROM php:7.4-cli-buster
diff --git a/core/php8.0Action/Dockerfile b/core/php8.0Action/Dockerfile
index 5480d5f..303b292 100644
--- a/core/php8.0Action/Dockerfile
+++ b/core/php8.0Action/Dockerfile
@@ -26,12 +26,12 @@ RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
# or build it from a release
FROM golang:1.18 AS builder_release
-ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
+ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
RUN curl -sL \
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
| tar xzf -\
&& cd openwhisk-runtime-go-*/main\
- && GO111MODULE=on go build -o /bin/proxy
+ && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
FROM php:8.0-cli-buster
diff --git a/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala b/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
index 2a46442..827cb09 100644
--- a/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala
@@ -486,4 +486,49 @@ abstract class Php7ActionContainerTests extends BasicActionRunnerTests with WskA
runRes.get.fields.get("result") shouldBe Some(JsString("it works"))
}
}
+
+ it should "support return array result" in {
+ val srcs = Seq(
+ Seq("index.php") ->
+ """
+ | <?php
+ | function main(array $args) : array
+ | {
+ | $result=array("a","b");
+ | return $result;
+ | }
+ """.stripMargin)
+
+ val code = ZipBuilder.mkBase64Zip(srcs)
+
+ withPhp7Container { c =>
+ c.init(initPayload(code))._1 should be(200)
+
+ val (runCode, runRes) = c.run(runPayload(JsObject()))
+ runCode should be(200)
+ runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
+ }
+ }
+
+ it should "support array as input param" in {
+ val srcs = Seq(
+ Seq("index.php") ->
+ """
+ | <?php
+ | function main(array $args) : array
+ | {
+ | return $args;
+ | }
+ """.stripMargin)
+
+ val code = ZipBuilder.mkBase64Zip(srcs)
+
+ withPhp7Container { c =>
+ c.init(initPayload(code))._1 should be(200)
+
+ val (runCode, runRes) = c.run(runPayload(JsArray(JsString("a"), JsString("b"))))
+ runCode should be(200)
+ runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
+ }
+ }
}