Skip to content

Commit c0115c8

Browse files
ningyougangmsciabarra
authored andcommitted
Support array result include sequence action (apache#120)
1 parent d817d8e commit c0115c8

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

core/php7.4Action/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
2626

2727
# or build it from a release
2828
FROM golang:1.18 AS builder_release
29-
ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
29+
ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
3030
RUN curl -sL \
3131
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
3232
| tar xzf -\
3333
&& cd openwhisk-runtime-go-*/main\
34-
&& GO111MODULE=on go build -o /bin/proxy
34+
&& GO111MODULE=on GO111MODULE=on go build -o /bin/proxy
3535

3636
FROM php:7.4-cli-buster
3737

core/php8.0Action/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \
2626

2727
# or build it from a release
2828
FROM golang:1.18 AS builder_release
29-
ARG GO_PROXY_RELEASE_VERSION=1.18@1.19.0
29+
ARG GO_PROXY_RELEASE_VERSION=1.18@1.20.0
3030
RUN curl -sL \
3131
https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\
3232
| tar xzf -\
3333
&& cd openwhisk-runtime-go-*/main\
34-
&& GO111MODULE=on go build -o /bin/proxy
34+
&& GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy
3535

3636
FROM php:8.0-cli-buster
3737

tests/src/test/scala/runtime/actionContainers/Php7ActionContainerTests.scala

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,4 +486,49 @@ abstract class Php7ActionContainerTests extends BasicActionRunnerTests with WskA
486486
runRes.get.fields.get("result") shouldBe Some(JsString("it works"))
487487
}
488488
}
489+
490+
it should "support return array result" in {
491+
val srcs = Seq(
492+
Seq("index.php") ->
493+
"""
494+
| <?php
495+
| function main(array $args) : array
496+
| {
497+
| $result=array("a","b");
498+
| return $result;
499+
| }
500+
""".stripMargin)
501+
502+
val code = ZipBuilder.mkBase64Zip(srcs)
503+
504+
withPhp7Container { c =>
505+
c.init(initPayload(code))._1 should be(200)
506+
507+
val (runCode, runRes) = c.run(runPayload(JsObject()))
508+
runCode should be(200)
509+
runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
510+
}
511+
}
512+
513+
it should "support array as input param" in {
514+
val srcs = Seq(
515+
Seq("index.php") ->
516+
"""
517+
| <?php
518+
| function main(array $args) : array
519+
| {
520+
| return $args;
521+
| }
522+
""".stripMargin)
523+
524+
val code = ZipBuilder.mkBase64Zip(srcs)
525+
526+
withPhp7Container { c =>
527+
c.init(initPayload(code))._1 should be(200)
528+
529+
val (runCode, runRes) = c.run(runPayload(JsArray(JsString("a"), JsString("b"))))
530+
runCode should be(200)
531+
runRes shouldBe Some(JsObject("0" -> JsString("a"), "1" -> JsString("b")))
532+
}
533+
}
489534
}

0 commit comments

Comments
 (0)