You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/03/15 04:22:04 UTC

[incubator-openwhisk] branch master updated: Add swift41 settings gradle (#3441)

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

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a5143a  Add swift41 settings gradle (#3441)
3a5143a is described below

commit 3a5143ac7beae265edda1c2a2e78d0f904f41af6
Author: Carlos Santana <cs...@gmail.com>
AuthorDate: Thu Mar 15 00:22:01 2018 -0400

    Add swift41 settings gradle (#3441)
---
 settings.gradle                                    |   1 +
 .../scala/system/basic/WskBasicSwift3Tests.scala   |   2 +-
 .../system/basic/WskRestBasicSwift311Tests.scala   |   1 +
 .../scala/whisk/core/cli/test/Swift311Tests.scala  | 157 +--------------------
 4 files changed, 4 insertions(+), 157 deletions(-)

diff --git a/settings.gradle b/settings.gradle
index 57c8993..4c76198 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -8,6 +8,7 @@ include 'actionRuntimes:actionProxy'
 include 'actionRuntimes:pythonAction'
 include 'actionRuntimes:python2Action'
 include 'actionRuntimes:swift3.1.1Action'
+include 'actionRuntimes:swift4.1Action'
 include 'actionRuntimes:javaAction'
 include 'actionRuntimes:php7.1Action'
 
diff --git a/tests/src/test/scala/system/basic/WskBasicSwift3Tests.scala b/tests/src/test/scala/system/basic/WskBasicSwift3Tests.scala
index ea6e14c..1711f8e 100644
--- a/tests/src/test/scala/system/basic/WskBasicSwift3Tests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicSwift3Tests.scala
@@ -47,7 +47,7 @@ abstract class WskBasicSwift3Tests extends TestHelpers with WskTestHelpers with
       val file = Some(TestUtils.getTestActionFilename("niam.swift"))
 
       assetHelper.withCleaner(wsk.action, name) { (action, _) =>
-        action.create(name, file, main = Some("niam"))
+        action.create(name, file, main = Some("niam"), kind = Some(actionKind))
       }
 
       withActivation(wsk.activation, wsk.action.invoke(name)) { activation =>
diff --git a/tests/src/test/scala/system/basic/WskRestBasicSwift311Tests.scala b/tests/src/test/scala/system/basic/WskRestBasicSwift311Tests.scala
index 16e46a9..06e4323 100644
--- a/tests/src/test/scala/system/basic/WskRestBasicSwift311Tests.scala
+++ b/tests/src/test/scala/system/basic/WskRestBasicSwift311Tests.scala
@@ -25,4 +25,5 @@ import org.scalatest.junit.JUnitRunner
 @RunWith(classOf[JUnitRunner])
 class WskRestBasicSwift311Tests extends WskBasicSwift3Tests {
   override val wsk: common.rest.WskRest = new WskRest
+  override lazy val actionKind = "swift:3.1.1"
 }
diff --git a/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala b/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala
index f43778f..26ed58d 100644
--- a/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala
@@ -18,7 +18,6 @@
 package whisk.core.cli.test
 
 import scala.concurrent.duration.DurationInt
-import scala.language.postfixOps
 import org.junit.runner.RunWith
 import org.scalatest.Matchers
 import org.scalatest.junit.JUnitRunner
@@ -48,7 +47,7 @@ class Swift311Tests extends TestHelpers with WskTestHelpers with Matchers {
   it should "invoke a swift action" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
     val name = "helloSwift"
     assetHelper.withCleaner(wsk.action, name) { (action, _) =>
-      action.create(name, Some(TestUtils.getTestActionFilename("hello.swift")))
+      action.create(name, Some(TestUtils.getTestActionFilename("hello.swift")), kind = Some(runtimeContainer))
     }
 
     withActivation(wsk.activation, wsk.action.invoke(name), totalWait = activationPollDuration) {
@@ -63,158 +62,4 @@ class Swift311Tests extends TestHelpers with WskTestHelpers with Matchers {
     }
   }
 
-  behavior of "Swift Whisk SDK tests"
-
-  it should "allow Swift actions to invoke other actions" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    // use CLI to create action from dat/actions/invokeAction.swift
-    val file = TestUtils.getTestActionFilename("invoke.swift")
-    val actionName = "invokeAction"
-    assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
-      action.create(name = actionName, artifact = Some(file), kind = Some(runtimeContainer))
-    }
-
-    // invoke the action
-    val run = wsk.action.invoke(actionName)
-    withActivation(wsk.activation, run, initialWait = 5 seconds, totalWait = 60 seconds) { activation =>
-      // should be successful
-      activation.response.success shouldBe true
-
-      // should have a field named "activationId" which is the date action's activationId
-      activation.response.result.get.fields("activationId").toString.length should be >= 32
-
-      // check for "date" field that comes from invoking the date action
-      //activation.response.result.get.fieldPathExists("response", "result", "date") should be(true)
-    }
-  }
-
-  it should "allow Swift actions to invoke other actions and not block" in withAssetCleaner(wskprops) {
-    (wp, assetHelper) =>
-      // use CLI to create action from dat/actions/invokeNonBlocking.swift
-      val file = TestUtils.getTestActionFilename("invokeNonBlocking.swift")
-      val actionName = "invokeNonBlockingAction"
-      assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
-        action.create(name = actionName, artifact = Some(file), kind = Some(runtimeContainer))
-      }
-
-      // invoke the action
-      val run = wsk.action.invoke(actionName)
-      withActivation(wsk.activation, run, initialWait = 5 seconds, totalWait = 60 seconds) { activation =>
-        // should not have a "response"
-        whisk.utils.JsHelpers.fieldPathExists(activation.response.result.get, "response") shouldBe false
-
-        // should have a field named "activationId" which is the date action's activationId
-        activation.response.result.get.fields("activationId").toString.length should be >= 32
-      }
-  }
-
-  it should "allow Swift actions to trigger events" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    // create a trigger
-    val triggerName = s"TestTrigger ${System.currentTimeMillis()}"
-    val ruleName = s"TestTriggerRule ${System.currentTimeMillis()}"
-    val ruleActionName = s"TestTriggerAction ${System.currentTimeMillis()}"
-    assetHelper.withCleaner(wsk.trigger, triggerName) { (trigger, _) =>
-      trigger.create(triggerName)
-    }
-
-    assetHelper.withCleaner(wsk.action, ruleActionName) { (action, name) =>
-      action.create(name, defaultJsAction)
-    }
-
-    assetHelper.withCleaner(wsk.rule, ruleName) { (rule, name) =>
-      rule.create(name, trigger = triggerName, action = ruleActionName)
-    }
-
-    // create an action that fires the trigger
-    val file = TestUtils.getTestActionFilename("trigger.swift")
-    val actionName = "ActionThatTriggers"
-    assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
-      action.create(name = actionName, artifact = Some(file), kind = Some(runtimeContainer))
-    }
-
-    // invoke the action
-    val run = wsk.action.invoke(actionName, Map("triggerName" -> triggerName.toJson))
-    withActivation(wsk.activation, run, initialWait = 5 seconds, totalWait = 60 seconds) { activation =>
-      // should be successful
-      activation.response.success shouldBe true
-
-      // should have a field named "activationId" which is the date action's activationId
-      activation.response.result.get.fields("activationId").toString.length should be >= 32
-
-      // should result in an activation for triggerName
-      val triggerActivations = wsk.activation.pollFor(1, Some(triggerName), retries = 20)
-      withClue(s"trigger activations for $triggerName:") {
-        triggerActivations.length should be(1)
-      }
-    }
-  }
-
-  it should "allow Swift actions to create a trigger" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    // create an action that creates the trigger
-    val file = TestUtils.getTestActionFilename("createTrigger.swift")
-    val actionName = "ActionThatTriggers"
-
-    // the name of the trigger to create
-    val triggerName = s"TestTrigger ${System.currentTimeMillis()}"
-
-    assetHelper.withCleaner(wsk.action, actionName) { (action, _) =>
-      assetHelper.withCleaner(wsk.trigger, triggerName) { (_, _) =>
-        // using an asset cleaner on the created trigger name will clean it up at the conclusion of the test
-        action.create(name = actionName, artifact = Some(file), kind = Some(runtimeContainer))
-      }
-    }
-
-    // invoke the action
-    val run = wsk.action.invoke(actionName, Map("triggerName" -> triggerName.toJson))
-    withActivation(wsk.activation, run, initialWait = 5 seconds, totalWait = 60 seconds) { activation =>
-      // should be successful
-      activation.response.success shouldBe true
-
-      // should have a field named "name" which is the name of the trigger created
-      activation.response.result.get.fields("name") shouldBe triggerName.toJson
-    }
-  }
-
-  it should "allow Swift actions to create a rule" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
-    val ruleTriggerName = s"TestTrigger ${System.currentTimeMillis()}"
-    val ruleActionName = s"TestAction ${System.currentTimeMillis()}"
-    val ruleName = s"TestRule ${System.currentTimeMillis()}"
-
-    // create a dummy action and trigger for the rule
-    assetHelper.withCleaner(wsk.action, ruleActionName) { (action, name) =>
-      val dummyFile = TestUtils.getTestActionFilename("hello.swift")
-      action.create(name, artifact = Some(dummyFile), kind = Some(runtimeContainer))
-    }
-
-    assetHelper.withCleaner(wsk.trigger, ruleTriggerName) { (trigger, name) =>
-      assetHelper.withCleaner(wsk.rule, ruleName) { (_, _) =>
-        // using an asset cleaner on the created trigger name will clean it up at the conclusion of the test
-        trigger.create(name)
-      }
-    }
-
-    // create an action that creates the rule
-    val createRuleFile = TestUtils.getTestActionFilename("createRule.swift")
-    assetHelper.withCleaner(wsk.action, "ActionThatCreatesRule") { (action, name) =>
-      action.create(name, artifact = Some(createRuleFile), kind = Some(runtimeContainer))
-    }
-
-    // invoke the create rule action
-    val runCreateRule = wsk.action.invoke(
-      "ActionThatCreatesRule",
-      Map(
-        "triggerName" -> s"/_/$ruleTriggerName".toJson,
-        "actionName" -> s"/_/$ruleActionName".toJson,
-        "ruleName" -> ruleName.toJson))
-
-    withActivation(wsk.activation, runCreateRule, initialWait = 5 seconds, totalWait = 60 seconds) { activation =>
-      // should be successful
-      activation.response.success shouldBe true
-
-      // should have a field named "trigger" which is the name of the trigger associated with the rule
-      activation.response.result.get.fields("trigger").asJsObject.fields("name") shouldBe ruleTriggerName.toJson
-
-      // should have a field named "action" which is the name of the action associated with the rule
-      activation.response.result.get.fields("action").asJsObject.fields("name") shouldBe ruleActionName.toJson
-    }
-  }
 }

-- 
To stop receiving notification emails like this one, please contact
csantanapr@apache.org.