dubee closed pull request #3538: Code clean up in test suites
URL: https://github.com/apache/incubator-openwhisk/pull/3538
 
 
   

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/tests/src/test/scala/system/basic/WskBasicTests.scala 
b/tests/src/test/scala/system/basic/WskBasicTests.scala
index 6584a1c6b8..6b33086152 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -193,20 +193,20 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
       }
 
       val stderr = wsk.pkg.create(name, expectedExitCode = 
Conflict.intValue).stderr
-      stderr should include regex ("""resource already exists""")
+      stderr should include("resource already exists")
   }
 
   it should "reject delete of package that does not exist" in {
     val name = "nonexistentPackage"
     val stderr = wsk.pkg.delete(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject get of package that does not exist" in {
     val name = "nonexistentPackage"
     val ns = wsk.namespace.whois()
     val stderr = wsk.pkg.get(name, expectedExitCode = NotFound.intValue).stderr
-    stderr should include regex (s"""The requested resource '$ns/$name' does 
not exist""")
+    stderr should include(s"The requested resource '$ns/$name' does not exist")
   }
 
   behavior of "Wsk Action REST"
@@ -252,25 +252,25 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
       }
 
       val stderr = wsk.action.create(name, file, expectedExitCode = 
Conflict.intValue).stderr
-      stderr should include regex ("""resource already exists""")
+      stderr should include("resource already exists")
   }
 
   it should "reject delete of action that does not exist" in {
     val name = "nonexistentAction"
     val stderr = wsk.action.delete(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject invocation of action that does not exist" in {
     val name = "nonexistentAction"
     val stderr = wsk.action.invoke(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject get of an action that does not exist" in {
     val name = "nonexistentAction"
     val stderr = wsk.action.get(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "create, and invoke an action that utilizes a docker container" in 
withAssetCleaner(wskprops) {
@@ -697,25 +697,25 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
       }
 
       val stderr = wsk.trigger.create(name, expectedExitCode = 
Conflict.intValue).stderr
-      stderr should include regex ("""resource already exists""")
+      stderr should include("resource already exists")
   }
 
   it should "reject delete of trigger that does not exist" in {
     val name = "nonexistentTrigger"
     val stderr = wsk.trigger.delete(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject get of trigger that does not exist" in {
     val name = "nonexistentTrigger"
     val stderr = wsk.trigger.get(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject firing of a trigger that does not exist" in {
     val name = "nonexistentTrigger"
     val stderr = wsk.trigger.fire(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "create and fire a trigger with a rule whose action has been 
deleted" in withAssetCleaner(wskprops) {
@@ -969,37 +969,37 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
         wsk.rule
           .create(ruleName, trigger = triggerName, action = actionName, 
expectedExitCode = Conflict.intValue)
           .stderr
-      stderr should include regex ("""resource already exists""")
+      stderr should include("resource already exists")
   }
 
   it should "reject delete of rule that does not exist" in {
     val name = "nonexistentRule"
     val stderr = wsk.rule.delete(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject enable of rule that does not exist" in {
     val name = "nonexistentRule"
     val stderr = wsk.rule.enable(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject disable of rule that does not exist" in {
     val name = "nonexistentRule"
     val stderr = wsk.rule.disable(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject status of rule that does not exist" in {
     val name = "nonexistentRule"
     val stderr = wsk.rule.state(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject get of rule that does not exist" in {
     val name = "nonexistentRule"
     val stderr = wsk.rule.get(name, expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   behavior of "Wsk Namespace REST"
@@ -1049,18 +1049,18 @@ class WskBasicTests extends TestHelpers with 
WskTestHelpers {
   it should "reject get of activation that does not exist" in {
     val name = "0" * 32
     val stderr = wsk.activation.get(Some(name), expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject logs of activation that does not exist" in {
     val name = "0" * 32
     val stderr = wsk.activation.logs(Some(name), expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 
   it should "reject result of activation that does not exist" in {
     val name = "0" * 32
     val stderr = wsk.activation.result(Some(name), expectedExitCode = 
NotFound.intValue).stderr
-    stderr should include regex ("""The requested resource does not exist.""")
+    stderr should include("The requested resource does not exist.")
   }
 }
diff --git a/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala
index 3fb8d2da17..869afe24fa 100644
--- a/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/ApiGwRestTests.scala
@@ -142,7 +142,7 @@ class ApiGwRestTests extends ApiGwTests with RestUtil {
   }
 
   override def verifyApiGet(rr: RunResult): Unit = {
-    rr.stdout should include regex 
(s""""operationId":"getPathWithSub_pathsInIt"""")
+    rr.stdout should include(s""""operationId":"getPathWithSub_pathsInIt"""")
   }
 
   override def verifyApiFullList(rr: RunResult,
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 50d4c575d1..95889236c3 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -116,7 +116,7 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
     }
     wsk.action
       .create(name, None, update = true, kind = Some("sequence"), 
expectedExitCode = BadRequest.intValue)
-      .stderr should include regex "The request content was 
malformed:\n'components' must be defined for sequence kind"
+      .stderr should include("The request content was malformed:\n'components' 
must be defined for sequence kind")
   }
 
   it should "create, and get an action to verify parameter and annotation 
parsing" in withAssetCleaner(wskprops) {
@@ -290,7 +290,7 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
           kind = Some("foobar"),
           expectedExitCode = BadRequest.intValue)
       }
-      rr.stderr should include regex "kind 'foobar' not in Set"
+      rr.stderr should include("kind 'foobar' not in Set")
   }
 
   it should "report error when creating an action with zip but without kind" 
in withAssetCleaner(wskprops) {
@@ -301,7 +301,7 @@ class WskBasicUsageTests extends TestHelpers with 
WskTestHelpers {
         action.create(name, zippedPythonAction, expectedExitCode = 
ANY_ERROR_EXIT)
       }
 
-      createResult.stderr should include regex "kind '' not in Set"
+      createResult.stderr should include("kind '' not in Set")
   }
 
   it should "create, and invoke an action that utilizes an invalid docker 
container with appropriate error" in withAssetCleaner(
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
index 0a6174a766..8a1e5121f1 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskEntitlementTests.scala
@@ -173,7 +173,7 @@ abstract class WskEntitlementTests extends TestHelpers with 
WskTestHelpers with
 
   def verifyPackageNotSharedList(packageList: RunResult, namespace: String, 
packageName: String): Unit = {
     val fullyQualifiedPackageName = s"/$namespace/$packageName"
-    packageList.stdout should not include regex(fullyQualifiedPackageName)
+    packageList.stdout should not include (fullyQualifiedPackageName)
   }
 
   it should "list shared package actions" in withAssetCleaner(guestWskProps) { 
(wp, assetHelper) =>
@@ -194,7 +194,7 @@ abstract class WskEntitlementTests extends TestHelpers with 
WskTestHelpers with
 
   def verifyPackageList(packageList: RunResult, namespace: String, 
packageName: String, actionName: String): Unit = {
     val result = packageList.stdout
-    result should include regex (s"/$namespace/$packageName/$actionName")
+    result should include(s"/$namespace/$packageName/$actionName")
   }
 
   behavior of "Wsk Package Binding"
@@ -214,11 +214,11 @@ abstract class WskEntitlementTests extends TestHelpers 
with WskTestHelpers with
 
       val stdout = wsk.pkg.get(name)(defaultWskProps).stdout
       val annotationString = 
wsk.parseJsonString(stdout).fields("annotations").toString
-      annotationString should include regex (""""key":"a"""")
-      annotationString should include regex (""""value":"A"""")
-      annotationString should include regex 
(s""""key":"${WhiskPackage.bindingFieldName}"""")
-      annotationString should not include regex(""""key":"xxx"""")
-      annotationString should include regex (s""""name":"${samplePackage}"""")
+      annotationString should include(""""key":"a"""")
+      annotationString should include(""""value":"A"""")
+      annotationString should 
include(s""""key":"${WhiskPackage.bindingFieldName}"""")
+      annotationString should not include (""""key":"xxx"""")
+      annotationString should include(s""""name":"${samplePackage}"""")
     }
   }
 
@@ -265,8 +265,8 @@ abstract class WskEntitlementTests extends TestHelpers with 
WskTestHelpers with
     stdout should include("name")
     stdout should include("parameters")
     stdout should include("limits")
-    stdout should include regex (""""key": "a"""")
-    stdout should include regex (""""value": "A"""")
+    stdout should include(""""key": "a"""")
+    stdout should include(""""value": "A"""")
   }
 
   it should "invoke an action sequence from package" in 
withAssetCleaner(guestWskProps) { (wp, assetHelper) =>
diff --git 
a/tests/src/test/scala/whisk/core/cli/test/WskRestEntitlementTests.scala 
b/tests/src/test/scala/whisk/core/cli/test/WskRestEntitlementTests.scala
index f5258f0c16..200782d714 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskRestEntitlementTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskRestEntitlementTests.scala
@@ -40,8 +40,8 @@ class WskRestEntitlementTests extends WskEntitlementTests {
     stdout should include("name")
     stdout should include("parameters")
     stdout should include("limits")
-    stdout should include regex (""""key":"a"""")
-    stdout should include regex (""""value":"A"""")
+    stdout should include(""""key":"a"""")
+    stdout should include(""""value":"A"""")
   }
 
   override def verifyPackageList(packageList: RunResult,


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to