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 2018/07/06 12:50:29 UTC

[incubator-openwhisk-runtime-swift] branch master updated (011a5c7 -> 07763c2)

This is an automated email from the ASF dual-hosted git repository.

dgrove pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-swift.git.


    from 011a5c7  add to travis.yml the runtime repo in the deploy block (#67)
     new 609cde6  Update base images to openwhisk/dockerskeleton:1.3.1.
     new 07763c2  Update tests.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core/swift3.1.1Action/CHANGELOG.md                 |   4 +
 core/swift3.1.1Action/Dockerfile                   |   2 +-
 core/swift41Action/CHANGELOG.md                    |   4 +
 core/swift41Action/Dockerfile                      |   2 +-
 tests/.pydevproject                                |   5 -
 .../SwiftActionContainerTests.scala                | 139 ++-------------------
 .../SwiftCodableActionContainerTests.scala         |   5 +-
 .../src/test/scala/runtime/sdk/SwiftSDKTests.scala |   9 +-
 8 files changed, 28 insertions(+), 142 deletions(-)
 delete mode 100644 tests/.pydevproject


[incubator-openwhisk-runtime-swift] 01/02: Update base images to openwhisk/dockerskeleton:1.3.1.

Posted by dg...@apache.org.
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/incubator-openwhisk-runtime-swift.git

commit 609cde6b0d669af918c9605a2a6076f36257b9ff
Author: Rodric Rabbah <ro...@gmail.com>
AuthorDate: Thu Jul 5 20:32:57 2018 -0400

    Update base images to openwhisk/dockerskeleton:1.3.1.
---
 core/swift3.1.1Action/CHANGELOG.md | 4 ++++
 core/swift3.1.1Action/Dockerfile   | 2 +-
 core/swift41Action/CHANGELOG.md    | 4 ++++
 core/swift41Action/Dockerfile      | 2 +-
 tests/.pydevproject                | 5 -----
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/core/swift3.1.1Action/CHANGELOG.md b/core/swift3.1.1Action/CHANGELOG.md
index 146b9da..6eb342c 100644
--- a/core/swift3.1.1Action/CHANGELOG.md
+++ b/core/swift3.1.1Action/CHANGELOG.md
@@ -19,6 +19,10 @@
 
 # Apache OpenWhisk Swift 3.1 Runtime Container
 
+## 1.0.1
+Changes:
+  - Update base image to openwhisk/dockerskeleton:1.3.1
+
 ## 1.0.0
 Initial Swift 3.1 image
   - Image name: `openwhisk/action-swift-v3.1.1`
diff --git a/core/swift3.1.1Action/Dockerfile b/core/swift3.1.1Action/Dockerfile
index dc64d91..e727f3b 100755
--- a/core/swift3.1.1Action/Dockerfile
+++ b/core/swift3.1.1Action/Dockerfile
@@ -27,7 +27,7 @@ RUN apt-get -y update \
  && apt-get -y install --fix-missing python2.7 python-gevent python-flask zip
 
 # Add the action proxy
-ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.1.0/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py
+ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.3.1/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py
 
 # Add files needed to build and run action
 RUN mkdir -p /swift3Action
diff --git a/core/swift41Action/CHANGELOG.md b/core/swift41Action/CHANGELOG.md
index d98c082..d8f1379 100644
--- a/core/swift41Action/CHANGELOG.md
+++ b/core/swift41Action/CHANGELOG.md
@@ -19,6 +19,10 @@
 
 # Apache OpenWhisk Swift 4.1 Runtime Container
 
+## 1.0.6
+Changes:
+  - Update base image to openwhisk/dockerskeleton:1.3.1
+
 ## 1.0.5
 Changes:
   - update to pass swiftc flags -Xswiftc -Onone to workaround swift optimization problem
diff --git a/core/swift41Action/Dockerfile b/core/swift41Action/Dockerfile
index cd3ae84..96fa9b5 100644
--- a/core/swift41Action/Dockerfile
+++ b/core/swift41Action/Dockerfile
@@ -72,7 +72,7 @@ RUN apt-get -y update \
  && apt-get -y install --fix-missing python2.7 python-gevent python-flask zip
 
 # Add the action proxy
-ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.1.0/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py
+ADD https://raw.githubusercontent.com/apache/incubator-openwhisk-runtime-docker/dockerskeleton%401.3.1/core/actionProxy/actionproxy.py /actionProxy/actionproxy.py
 
 # Add files needed to build and run action
 RUN mkdir -p /swift4Action/spm-build/Sources/Action
diff --git a/tests/.pydevproject b/tests/.pydevproject
deleted file mode 100644
index 40e9f40..0000000
--- a/tests/.pydevproject
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse-pydev version="1.0"?><pydev_project>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
-</pydev_project>


[incubator-openwhisk-runtime-swift] 02/02: Update tests.

Posted by dg...@apache.org.
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/incubator-openwhisk-runtime-swift.git

commit 07763c243e7d91e987b5a0fc2174ac7274923ba7
Author: Rodric Rabbah <ro...@gmail.com>
AuthorDate: Thu Jul 5 21:02:34 2018 -0400

    Update tests.
---
 .../SwiftActionContainerTests.scala                | 139 ++-------------------
 .../SwiftCodableActionContainerTests.scala         |   5 +-
 .../src/test/scala/runtime/sdk/SwiftSDKTests.scala |   9 +-
 3 files changed, 18 insertions(+), 135 deletions(-)

diff --git a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala b/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala
index 1ba70b0..8087b77 100644
--- a/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/SwiftActionContainerTests.scala
@@ -19,9 +19,9 @@ package runtime.actionContainers
 
 import java.io.File
 import common.WskActorSystem
-import actionContainers.{ActionContainer, ActionProxyContainerTestUtils, ResourceHelpers}
+import actionContainers.{ActionContainer, BasicActionRunnerTests}
 import actionContainers.ActionContainer.withContainer
-import spray.json.DefaultJsonProtocol._
+import actionContainers.ResourceHelpers.readAsBase64
 import spray.json._
 
 abstract class SwiftActionContainerTests extends BasicActionRunnerTests with WskActorSystem {
@@ -35,6 +35,8 @@ abstract class SwiftActionContainerTests extends BasicActionRunnerTests with Wsk
 
   behavior of swiftContainerImageName
 
+  //testNoSourceOrExec(checkResultInLogs = false)
+
   testEcho(Seq {
     (
       "swift echo",
@@ -110,6 +112,12 @@ abstract class SwiftActionContainerTests extends BasicActionRunnerTests with Wsk
     },
     enforceEmptyOutputStream)
 
+  testInitCannotBeCalledMoreThanOnce("""
+        | func main(args: [String: Any]) -> [String: Any] {
+        |     return args
+        | }
+      """.stripMargin)
+
   it should "support actions using non-default entry points" in {
     withActionContainer() { c =>
       val code = """
@@ -201,7 +209,7 @@ abstract class SwiftActionContainerTests extends BasicActionRunnerTests with Wsk
 
   it should "support pre-compiled binary in a zip file" in {
     val zip = new File(swiftBinaryName).toPath
-    val code = ResourceHelpers.readAsBase64(zip)
+    val code = readAsBase64(zip)
 
     val (out, err) = withActionContainer() { c =>
       val (initCode, initRes) = c.init(initPayload(code))
@@ -252,128 +260,3 @@ abstract class SwiftActionContainerTests extends BasicActionRunnerTests with Wsk
   }
 
 }
-
-trait BasicActionRunnerTests extends ActionProxyContainerTestUtils {
-  def withActionContainer(env: Map[String, String] = Map.empty)(code: ActionContainer => Unit): (String, String)
-
-  /**
-   * Runs tests for actions which do not return a dictionary and confirms expected error messages.
-   * @param codeNotReturningJson code to execute, should not return a JSON object
-   * @param checkResultInLogs should be true iff the result of the action is expected to appear in stdout or stderr
-   */
-  def testNotReturningJson(codeNotReturningJson: String, checkResultInLogs: Boolean = true) = {
-    it should "run and report an error for script not returning a json object" in {
-      val (out, err) = withActionContainer() { c =>
-        val (initCode, _) = c.init(initPayload(codeNotReturningJson))
-        initCode should be(200)
-        val (runCode, out) = c.run(JsObject())
-        runCode should be(502)
-        out should be(Some(JsObject("error" -> JsString("The action did not return a dictionary."))))
-      }
-
-      checkStreams(out, err, {
-        case (o, e) =>
-          if (checkResultInLogs) {
-            (o + e) should include("not a json object")
-          } else {
-            o shouldBe empty
-            e shouldBe empty
-          }
-      })
-    }
-  }
-
-  /**
-   * Runs tests for code samples which are expected to echo the input arguments
-   * and print hello [stdout, stderr].
-   */
-  def testEcho(stdCodeSamples: Seq[(String, String)]) = {
-    stdCodeSamples.foreach { s =>
-      it should s"run a ${s._1} script" in {
-        val argss = List(
-          JsObject("string" -> JsString("hello")),
-          JsObject("string" -> JsString("❄ ☃ ❄")),
-          JsObject("numbers" -> JsArray(JsNumber(42), JsNumber(1))),
-          // JsObject("boolean" -> JsBoolean(true)), // fails with swift3 returning boolean: 1
-          JsObject("object" -> JsObject("a" -> JsString("A"))))
-
-        val (out, err) = withActionContainer() { c =>
-          val (initCode, _) = c.init(initPayload(s._2))
-          initCode should be(200)
-
-          for (args <- argss) {
-            val (runCode, out) = c.run(runPayload(args))
-            runCode should be(200)
-            out should be(Some(args))
-          }
-        }
-
-        checkStreams(out, err, {
-          case (o, e) =>
-            o should include("hello stdout")
-            e should include("hello stderr")
-        }, argss.length)
-      }
-    }
-  }
-
-  def testUnicode(stdUnicodeSamples: Seq[(String, String)]) = {
-    stdUnicodeSamples.foreach { s =>
-      it should s"run a ${s._1} action and handle unicode in source, input params, logs, and result" in {
-        val (out, err) = withActionContainer() { c =>
-          val (initCode, _) = c.init(initPayload(s._2))
-          initCode should be(200)
-
-          val (runCode, runRes) = c.run(runPayload(JsObject("delimiter" -> JsString("❄"))))
-          runRes.get.fields.get("winter") shouldBe Some(JsString("❄ ☃ ❄"))
-        }
-
-        checkStreams(out, err, {
-          case (o, _) =>
-            o.toLowerCase should include("❄ ☃ ❄")
-        })
-      }
-    }
-  }
-
-  /** Runs tests for code samples which are expected to return the expected standard environment {auth, edge}. */
-  def testEnv(stdEnvSamples: Seq[(String, String)],
-              enforceEmptyOutputStream: Boolean = true,
-              enforceEmptyErrorStream: Boolean = true) = {
-    stdEnvSamples.foreach { s =>
-      it should s"run a ${s._1} script and confirm expected environment variables" in {
-        val props = Seq(
-          "api_host" -> "xyz",
-          "api_key" -> "abc",
-          "namespace" -> "zzz",
-          "action_name" -> "xxx",
-          "activation_id" -> "iii",
-          "deadline" -> "123")
-        val env = props.map { case (k, v) => s"__OW_${k.toUpperCase()}" -> v }
-
-        val (out, err) = withActionContainer(env.take(1).toMap) { c =>
-          val (initCode, _) = c.init(initPayload(s._2))
-          initCode should be(200)
-
-          val (runCode, out) = c.run(runPayload(JsObject(), Some(props.toMap.toJson.asJsObject)))
-          runCode should be(200)
-          out shouldBe defined
-          props.map {
-            case (k, v) =>
-              withClue(k) {
-                out.get.fields(k) shouldBe JsString(v)
-              }
-
-          }
-        }
-
-        checkStreams(out, err, {
-          case (o, e) =>
-            if (enforceEmptyOutputStream) o shouldBe empty
-            if (enforceEmptyErrorStream) e shouldBe empty
-        })
-      }
-    }
-
-  }
-}
diff --git a/tests/src/test/scala/runtime/actionContainers/SwiftCodableActionContainerTests.scala b/tests/src/test/scala/runtime/actionContainers/SwiftCodableActionContainerTests.scala
index cf60026..fc64f37 100644
--- a/tests/src/test/scala/runtime/actionContainers/SwiftCodableActionContainerTests.scala
+++ b/tests/src/test/scala/runtime/actionContainers/SwiftCodableActionContainerTests.scala
@@ -19,8 +19,9 @@ package runtime.actionContainers
 
 import java.io.File
 import common.WskActorSystem
-import actionContainers.{ActionContainer, ResourceHelpers}
+import actionContainers.{ActionContainer, BasicActionRunnerTests}
 import actionContainers.ActionContainer.withContainer
+import actionContainers.ResourceHelpers.readAsBase64
 import spray.json._
 
 abstract class SwiftCodableActionContainerTests extends BasicActionRunnerTests with WskActorSystem {
@@ -213,7 +214,7 @@ abstract class SwiftCodableActionContainerTests extends BasicActionRunnerTests w
 
   it should "support pre-compiled binary in a zip file" in {
     val zip = new File(swiftBinaryName).toPath
-    val code = ResourceHelpers.readAsBase64(zip)
+    val code = readAsBase64(zip)
 
     val (out, err) = withActionContainer() { c =>
       val (initCode, initRes) = c.init(initPayload(code))
diff --git a/tests/src/test/scala/runtime/sdk/SwiftSDKTests.scala b/tests/src/test/scala/runtime/sdk/SwiftSDKTests.scala
index d5437db..8822e31 100644
--- a/tests/src/test/scala/runtime/sdk/SwiftSDKTests.scala
+++ b/tests/src/test/scala/runtime/sdk/SwiftSDKTests.scala
@@ -18,18 +18,17 @@
 package runtime.sdk
 
 import java.io.File
+
 import scala.concurrent.duration.DurationInt
 import scala.language.postfixOps
-import org.scalatest.Matchers
-import common.{TestHelpers, WhiskProperties, WskProps, WskTestHelpers}
-import common.rest.WskRest
+import common._
 import spray.json._
 import spray.json.DefaultJsonProtocol.StringJsonFormat
 
-abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with Matchers {
+abstract class SwiftSDKTests extends TestHelpers with WskTestHelpers with WskActorSystem {
 
   implicit val wskprops = WskProps()
-  val wsk = new WskRest
+  val wsk = new Wsk
   val activationPollDuration = 2.minutes
   lazy val actionKind = "swift:3.1.1"
   lazy val lang = actionKind.split(":")(0)