openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markusthoem...@apache.org
Subject [incubator-openwhisk] branch master updated: Move tests of --last tag to BasicUsageTests (#2518)
Date Fri, 21 Jul 2017 09:47:45 GMT
This is an automated email from the ASF dual-hosted git repository.

markusthoemmes 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 e2f1b5c  Move tests of --last tag to BasicUsageTests (#2518)
e2f1b5c is described below

commit e2f1b5c60c13884361f34b019a26d62a7461864a
Author: Christian Bickel <github@cbickel.de>
AuthorDate: Fri Jul 21 11:47:43 2017 +0200

    Move tests of --last tag to BasicUsageTests (#2518)
---
 .../test/scala/system/basic/WskBasicTests.scala    | 28 ----------------
 .../whisk/core/cli/test/WskBasicUsageTests.scala   | 39 +++++++++++++++++++---
 2 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskBasicTests.scala
index 8e22088..0852710 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -35,7 +35,6 @@ import common.WskTestHelpers
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import spray.json.pimpAny
-import whisk.utils.retry
 
 @RunWith(classOf[JUnitRunner])
 class WskBasicTests
@@ -856,33 +855,6 @@ class WskBasicTests
         stderr should include regex (s"""Unable to get result for activation '$name': The
requested resource does not exist. \\(code \\d+\\)""")
     }
 
-    it should "retrieve the last activation using --last flag" in withAssetCleaner(wskprops)
{
-        (wp, assetHelper) =>
-            val auth: Seq[String] = Seq("--auth", wskprops.authKey)
-            val includeStr = "hello, undefined!"
-
-            assetHelper.withCleaner(wsk.action, "lastName") {
-                (action, _) => wsk.action.create("lastName", defaultAction)
-            }
-            val lastInvoke = wsk.action.invoke("lastName")
-            withActivation(wsk.activation, lastInvoke) {
-                activation =>
-                    val lastFlag = Seq(
-                        (Seq("activation", "get", "publish", "--last"), activation.activationId),
-                        (Seq("activation", "get", "--last"), activation.activationId),
-                        (Seq("activation", "logs", "--last"), includeStr),
-                        (Seq("activation", "result", "--last"), includeStr))
-
-                    retry({
-                        lastFlag foreach {
-                            case (cmd, output) =>
-                                val stdout = wsk.cli(cmd ++ wskprops.overrides ++ auth, expectedExitCode
= SUCCESS_EXIT).stdout
-                                stdout should include(output)
-                        }
-                    }, waitBeforeRetry = Some(500.milliseconds))
-            }
-    }
-
     it should "reject activation request when using activation ID with --last Flag" in withAssetCleaner(wskprops)
{
         (wp, assetHelper) =>
             val auth: Seq[String] = Seq("--auth", wskprops.authKey)
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
index 4a1be09..71c4cee 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -113,7 +113,7 @@ class WskBasicUsageTests
     }
 
     // If client certificate verification is off, should ingore run below tests.
-    if (!WhiskProperties.getProperty("whisk.ssl.client.verification").equals("off")){
+    if (!WhiskProperties.getProperty("whisk.ssl.client.verification").equals("off")) {
         it should "set valid cert key to get expected success result for client certificate
verification" in {
             val tmpwskprops = File.createTempFile("wskprops", ".tmp")
             try {
@@ -138,9 +138,9 @@ class WskBasicUsageTests
             try {
                 val namespace = wsk.namespace.list().stdout.trim.split("\n").last
                 val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-                val thrown = the [Exception] thrownBy wsk.cli(Seq("property", "set", "-i",
"--apihost", wskprops.apihost, "--auth", wskprops.authKey,
+                val thrown = the[Exception] thrownBy wsk.cli(Seq("property", "set", "-i",
"--apihost", wskprops.apihost, "--auth", wskprops.authKey,
                     "--cert", "invalid-cert.pem", "--key", "invalid-key.pem", "--namespace",
namespace), env = env)
-                thrown.getMessage should include ("cannot validate certificate")
+                thrown.getMessage should include("cannot validate certificate")
             } finally {
                 tmpwskprops.delete()
             }
@@ -216,9 +216,9 @@ class WskBasicUsageTests
             wsk.cli(Seq("property", "get", "--auth"), env = env).
                 stdout should include regex ("""(?i)whisk auth\s*$""") // default = empty
string
             wsk.cli(Seq("property", "get", "--cert"), env = env).
-              stdout should include regex ("""(?i)client cert\s*$""") // default = empty
string
+                stdout should include regex ("""(?i)client cert\s*$""") // default = empty
string
             wsk.cli(Seq("property", "get", "--key"), env = env).
-              stdout should include regex ("""(?i)client key\s*$""") // default = empty string
+                stdout should include regex ("""(?i)client key\s*$""") // default = empty
string
             wsk.cli(Seq("property", "get", "--apihost"), env = env).
                 stdout should include regex ("""(?i)whisk API host\s*$""") // default = empty
string
             wsk.cli(Seq("property", "get", "--namespace"), env = env).
@@ -453,6 +453,35 @@ class WskBasicUsageTests
             }
     }
 
+    it should "retrieve the last activation using --last flag" in withAssetCleaner(wskprops)
{
+        (wp, assetHelper) =>
+            val auth: Seq[String] = Seq("--auth", wskprops.authKey)
+            val includeStr = "hello, undefined!"
+
+            assetHelper.withCleaner(wsk.action, "lastName") {
+                (action, _) => wsk.action.create("lastName", defaultAction)
+            }
+            retry({
+                val lastInvoke = wsk.action.invoke("lastName")
+                withActivation(wsk.activation, lastInvoke) { activation =>
+                    val lastFlag = Seq(
+                        (Seq("activation", "get", "publish", "--last"), activation.activationId),
+                        (Seq("activation", "get", "--last"), activation.activationId),
+                        (Seq("activation", "logs", "--last"), includeStr),
+                        (Seq("activation", "result", "--last"), includeStr))
+
+                    retry({
+                        lastFlag foreach {
+                            case (cmd, output) =>
+                                val stdout = wsk.cli(cmd ++ wskprops.overrides ++ auth, expectedExitCode
= SUCCESS_EXIT).stdout
+                                stdout should include(output)
+                        }
+                    }, waitBeforeRetry = Some(500.milliseconds))
+
+                }
+            }, waitBeforeRetry = Some(1.second), N = 5)
+    }
+
     it should "ensure keys are not omitted from activation record" in withAssetCleaner(wskprops)
{
         val name = "activationRecordTest"
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <commits@openwhisk.apache.org>'].

Mime
View raw message