rabbah commented on a change in pull request #3103: Rewrite wsk basic tests
URL:
https://github.com/apache/incubator-openwhisk/pull/3103#discussion_r161285072
##########
File path: tests/src/test/scala/system/basic/WskBasicTests.scala
##########
@@ -732,56 +757,67 @@ class WskBasicTests extends TestHelpers with
WskTestHelpers {
}
val stderr =
- wsk.rule.create(ruleName, trigger = triggerName, action = actionName,
expectedExitCode = CONFLICT).stderr
- stderr should include regex (s"""Unable to create rule '$ruleName':
resource already exists \\(code \\d+\\)""")
+ wsk.rule
+ .create(ruleName, trigger = triggerName, action = actionName,
expectedExitCode = Conflict.intValue)
+ .stderr
+ stderr should include regex (s"""resource already exists""")
}
it should "reject delete of rule that does not exist" in {
val name = "nonexistentRule"
- val stderr = wsk.rule.delete(name, expectedExitCode = NOT_FOUND).stderr
- stderr should include regex (s"""Unable to delete rule '$name'. The
requested resource does not exist. \\(code \\d+\\)""")
+ val stderr = wsk.rule.delete(name, expectedExitCode =
NotFound.intValue).stderr
+ stderr should include regex (s"""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 = NOT_FOUND).stderr
- stderr should include regex (s"""Unable to enable rule '$name': The
requested resource does not exist. \\(code \\d+\\)""")
+ val stderr = wsk.rule.enable(name, expectedExitCode =
NotFound.intValue).stderr
+ stderr should include regex (s"""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 = NOT_FOUND).stderr
- stderr should include regex (s"""Unable to disable rule '$name': The
requested resource does not exist. \\(code \\d+\\)""")
+ val stderr = wsk.rule.disable(name, expectedExitCode =
NotFound.intValue).stderr
+ stderr should include regex (s"""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 = NOT_FOUND).stderr
- stderr should include regex (s"""Unable to get status of rule '$name': The
requested resource does not exist. \\(code \\d+\\)""")
+ val stderr = wsk.rule.state(name, expectedExitCode =
NotFound.intValue).stderr
+ stderr should include regex (s"""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 = NOT_FOUND).stderr
- stderr should include regex (s"""Unable to get rule '$name': The requested
resource does not exist. \\(code \\d+\\)""")
+ val stderr = wsk.rule.get(name, expectedExitCode =
NotFound.intValue).stderr
+ stderr should include regex (s"""The requested resource does not exist.""")
}
- behavior of "Wsk Namespace CLI"
+ behavior of "Wsk Namespace REST"
it should "return a list of exactly one namespace" in {
- val lines = wsk.namespace.list().stdout.lines.toSeq
- lines should have size 2
- lines.head shouldBe "namespaces"
- lines(1).trim should not be empty
+ val lines = wsk.namespace.list()
+ lines.getBodyListString().size shouldBe 1
}
it should "list entities in default namespace" in {
// use a fresh wsk props instance that is guaranteed to use
// the default namespace
- wsk.namespace.get(expectedExitCode = SUCCESS_EXIT)(WskProps()).stdout
should include("default")
+ val result = wsk.namespace.get()(WskProps()).stdout
+ result should include("actions")
Review comment:
how about parsing the output and checking that it's a JsObject that includes
these four fields, and each value is an JsArray.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services