Skip to content
Snippets Groups Projects
Commit 7f4921ad authored by rodric rabbah's avatar rodric rabbah Committed by David Grove
Browse files

Update base images to openwhisk/dockerskeleton:1.3.2. (#33)

Update base images to openwhisk/dockerskeleton:1.3.2. and adjust tests for upstream changes.
parent ef84f058
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
### Give it a try today ### Give it a try today
To use as a docker action using python 3 To use as a docker action using python 3
``` ```
wsk action update myAction myAction.py --docker openwhisk/python3action:1.0.1 wsk action update myAction myAction.py --docker openwhisk/python3action:1.0.2
``` ```
Replace `python3action` with `python2action` to use python 2. Replace `python3action` with `python2action` to use python 2.
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
# Python 2 OpenWhisk Runtime Container # Python 2 OpenWhisk Runtime Container
## 1.0.2
Changes:
- Update base image to openwhisk/dockerskeleton:1.3.2
## 1.0.1 ## 1.0.1
Changes: Changes:
- Update base image to openwhisk/dockerskeleton:1.3.1 - Update base image to openwhisk/dockerskeleton:1.3.1
......
...@@ -50,8 +50,9 @@ RUN pip install --no-cache-dir --upgrade pip setuptools six \ ...@@ -50,8 +50,9 @@ RUN pip install --no-cache-dir --upgrade pip setuptools six \
ENV FLASK_PROXY_PORT 8080 ENV FLASK_PROXY_PORT 8080
# Add the action proxy # Add the action proxy
ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.3.1/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.3.2/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py
ADD pythonrunner.py /pythonAction/ ADD pythonrunner.py /pythonAction/
RUN rm -rf /action
CMD ["/bin/bash", "-c", "cd pythonAction && python -u pythonrunner.py"] CMD ["/bin/bash", "-c", "cd pythonAction && python -u pythonrunner.py"]
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
# Python 3 OpenWhisk Runtime Container # Python 3 OpenWhisk Runtime Container
## 1.0.2
Changes:
- Update base image to openwhisk/dockerskeleton:1.3.2
## 1.0.1 ## 1.0.1
Changes: Changes:
- Update base image to openwhisk/dockerskeleton:1.3.1 - Update base image to openwhisk/dockerskeleton:1.3.1
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# #
# Dockerfile for python actions, overrides and extends ActionRunner from actionProxy # Dockerfile for python actions, overrides and extends ActionRunner from actionProxy
FROM openwhisk/dockerskeleton:1.3.1 FROM openwhisk/dockerskeleton:1.3.2
RUN apk add --no-cache \ RUN apk add --no-cache \
bzip2-dev \ bzip2-dev \
...@@ -45,5 +45,6 @@ ENV FLASK_PROXY_PORT 8080 ...@@ -45,5 +45,6 @@ ENV FLASK_PROXY_PORT 8080
RUN mkdir -p /pythonAction RUN mkdir -p /pythonAction
ADD pythonrunner.py /pythonAction/ ADD pythonrunner.py /pythonAction/
RUN rm -rf /action
CMD ["/bin/bash", "-c", "cd pythonAction && python -u pythonrunner.py"] CMD ["/bin/bash", "-c", "cd pythonAction && python -u pythonrunner.py"]
...@@ -42,87 +42,78 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys ...@@ -42,87 +42,78 @@ class PythonActionContainerTests extends BasicActionRunnerTests with WskActorSys
behavior of imageName behavior of imageName
testNotReturningJson( override val testNoSourceOrExec = TestConfig("")
""" override val testNoSource = TestConfig("", hasCodeStub = true)
|def main(args):
| return "not a json object" override val testNotReturningJson =
""".stripMargin, TestConfig("""
checkResultInLogs = false) |def main(args):
| return "not a json object"
testEcho(Seq { """.stripMargin)
(
"python", override val testInitCannotBeCalledMoreThanOnce =
TestConfig("""
|def main(args):
| return args
""".stripMargin)
override val testEntryPointOtherThanMain =
TestConfig(
"""
|def niam(args):
| return args
""".stripMargin,
main = "niam")
override val testEcho =
TestConfig("""
|from __future__ import print_function
|import sys
|def main(args):
| print('hello stdout')
| print('hello stderr', file=sys.stderr)
| return args
""".stripMargin)
override val testUnicode =
TestConfig(if (pythonStringAsUnicode) {
""" """
|from __future__ import print_function |def main(args):
|import sys | sep = args['delimiter']
|def main(args): | str = sep + " ☃ " + sep
| print('hello stdout') | print(str)
| print('hello stderr', file=sys.stderr) | return {"winter" : str }
| return args """.stripMargin.trim
""".stripMargin)
})
testUnicode(Seq {
if (pythonStringAsUnicode) {
(
"python",
"""
|def main(args):
| sep = args['delimiter']
| str = sep + " ☃ " + sep
| print(str)
| return {"winter" : str }
""".stripMargin.trim)
} else { } else {
(
"python",
"""
|def main(args):
| sep = args['delimiter']
| str = sep + " ☃ ".decode('utf-8') + sep
| print(str.encode('utf-8'))
| return {"winter" : str }
""".stripMargin.trim)
}
})
testEnv(Seq {
(
"python",
""" """
|import os |def main(args):
|def main(dict): | sep = args['delimiter']
| return { | str = sep + " ☃ ".decode('utf-8') + sep
| "api_host": os.environ['__OW_API_HOST'], | print(str.encode('utf-8'))
| "api_key": os.environ['__OW_API_KEY'], | return {"winter" : str }
| "namespace": os.environ['__OW_NAMESPACE'], """.stripMargin.trim
| "action_name": os.environ['__OW_ACTION_NAME'], })
| "activation_id": os.environ['__OW_ACTIVATION_ID'],
| "deadline": os.environ['__OW_DEADLINE'] override val testEnv =
| } TestConfig("""
""".stripMargin.trim) |import os
}) |def main(dict):
| return {
testInitCannotBeCalledMoreThanOnce(""" | "api_host": os.environ['__OW_API_HOST'],
| "api_key": os.environ['__OW_API_KEY'],
| "namespace": os.environ['__OW_NAMESPACE'],
| "action_name": os.environ['__OW_ACTION_NAME'],
| "activation_id": os.environ['__OW_ACTIVATION_ID'],
| "deadline": os.environ['__OW_DEADLINE']
| }
""".stripMargin.trim)
override val testLargeInput =
TestConfig("""
|def main(args): |def main(args):
| return args | return args
""".stripMargin) """.stripMargin)
it should "support actions using non-default entry points" in {
withActionContainer() { c =>
val code = """
|def niam(dict):
| return { "result": "it works" }
|""".stripMargin
val (initCode, initRes) = c.init(initPayload(code, main = "niam"))
initCode should be(200)
val (_, runRes) = c.run(runPayload(JsObject()))
runRes.get.fields.get("result") shouldBe Some(JsString("it works"))
}
}
it should "support zip-encoded action using non-default entry points" in { it should "support zip-encoded action using non-default entry points" in {
val srcs = Seq( val srcs = Seq(
Seq("__main__.py") -> """ Seq("__main__.py") -> """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment