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

[GitHub] csantanapr closed pull request #3441: Add swift41 settings gradle

csantanapr closed pull request #3441: Add swift41 settings gradle
URL: https://github.com/apache/incubator-openwhisk/pull/3441
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/settings.gradle b/settings.gradle
index 57c899386a..4c76198dbf 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 ea6e14cf88..1711f8ee7f 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 16e46a9070..06e43239e7 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 f43778f5e7..26ed58d05f 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
-    }
-  }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services