You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/04/12 17:19:05 UTC
[incubator-openwhisk] branch master updated: Code clean up in test
suites (#3538)
This is an automated email from the ASF dual-hosted git repository.
dubeejw 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 408d6f0 Code clean up in test suites (#3538)
408d6f0 is described below
commit 408d6f062d1af94f8f7153dc874a1c621d095d22
Author: James Dubee <jw...@us.ibm.com>
AuthorDate: Thu Apr 12 13:19:00 2018 -0400
Code clean up in test suites (#3538)
Removes improper usage of regex and """.
---
.../test/scala/system/basic/WskBasicTests.scala | 40 +++++++++++-----------
.../scala/whisk/core/cli/test/ApiGwRestTests.scala | 2 +-
.../whisk/core/cli/test/WskBasicUsageTests.scala | 6 ++--
.../whisk/core/cli/test/WskEntitlementTests.scala | 18 +++++-----
.../core/cli/test/WskRestEntitlementTests.scala | 4 +--
5 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskBasicTests.scala
index 6584a1c..6b33086 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 3fb8d2d..869afe2 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 50d4c57..9588923 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 0a6174a..8a1e512 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 f5258f0..200782d 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,
--
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.