houshengbo closed pull request #121: Sync up the latest test cases URL: https://github.com/apache/incubator-openwhisk-cli/pull/121
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 9a02bdb4..1142414a 100644 --- a/tests/src/test/scala/system/basic/WskBasicTests.scala +++ b/tests/src/test/scala/system/basic/WskBasicTests.scala @@ -36,6 +36,8 @@ import spray.json._ import spray.json.DefaultJsonProtocol._ import spray.json.pimpAny +import whisk.http.Messages + @RunWith(classOf[JUnitRunner]) class WskBasicTests extends TestHelpers with WskTestHelpers { @@ -168,8 +170,9 @@ class WskBasicTests extends TestHelpers with WskTestHelpers { 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 = NOT_FOUND).stderr - stderr should include regex (s"""Unable to get package '$name': The requested resource does not exist. \\(code \\d+\\)""") + stderr should include regex (s"""Unable to get package '$name': ${Messages.resourceDoesntExist(s"${ns}/${name}")} \\(code \\d+\\)""") } behavior of "Wsk Action CLI" diff --git a/tests/src/test/scala/system/basic/WskConsoleTests.scala b/tests/src/test/scala/system/basic/WskConsoleTests.scala index 80aae4db..c513eec5 100644 --- a/tests/src/test/scala/system/basic/WskConsoleTests.scala +++ b/tests/src/test/scala/system/basic/WskConsoleTests.scala @@ -74,9 +74,10 @@ abstract class WskConsoleTests extends TestHelpers with WskTestHelpers { // Time recorded by invoker, some contingency to make query more robust val queryTime = activation.start.minusMillis(500) // since: poll for activations since specified point in time (absolute) - val activations = wsk.activation.pollFor(N = 1, Some(actionName), since = Some(queryTime), retries = 80).length + val activations = + wsk.activation.pollFor(N = 1, Some(s"$packageName/$actionName"), since = Some(queryTime), retries = 80).length withClue( - s"expected activations of action '${actionName}' since ${queryTime.toString} / initial activation ${activation.activationId}:") { + s"expected activations of action '$fullActionName' since $queryTime, initial activation ${activation.activationId}:") { activations should be(1) } @@ -84,8 +85,7 @@ abstract class WskConsoleTests extends TestHelpers with WskTestHelpers { val pollTime = 10 seconds // since: poll for activations since specified number of seconds ago (relative) val console = wsk.activation.console(pollTime, since = Some(duration)) - withClue( - s"Poll for ${pollTime.toSeconds} seconds since ${duration.toSeconds} seconds did not return expected result:") { + withClue(s"Polled since ${duration.toSeconds} seconds, did not find expected result:") { console.stdout should include(payload) } } @@ -108,15 +108,14 @@ abstract class WskConsoleTests extends TestHelpers with WskTestHelpers { // since: poll for activations since specified point in time (absolute) val activations = wsk.activation.pollFor(N = 4, Some(name), since = Some(queryTime), retries = 80).length withClue( - s"expected activations of action '${name}' since ${queryTime.toString} / initial activation ${activation.activationId}:") { + s"expected activations of action '$name' since $queryTime, initial activation ${activation.activationId}:") { activations should be(count + 1) } val duration = Duration(Instant.now.minusMillis(start.toEpochMilli).toEpochMilli, MILLISECONDS) val pollTime = 10 seconds // since: poll for activations since specified number of seconds ago (relative) val console = wsk.activation.console(pollTime, since = Some(duration)) - withClue( - s"Poll for ${pollTime.toSeconds} seconds since ${duration.toSeconds} seconds did not return expected result:") { + withClue(s"Polled for ${duration.toSeconds} seconds, did not find expected result:") { console.stdout should include("Happy New Year") } } diff --git a/tests/src/test/scala/system/basic/WskRuleTests.scala b/tests/src/test/scala/system/basic/WskRuleTests.scala index a7929bab..89f0a217 100644 --- a/tests/src/test/scala/system/basic/WskRuleTests.scala +++ b/tests/src/test/scala/system/basic/WskRuleTests.scala @@ -147,7 +147,7 @@ abstract class WskRuleTests extends TestHelpers with WskTestHelpers { withActivationsFromEntity( wsk.activation, - actionName, + pkgActionName, since = Some(triggerActivation.start.minusMillis(activationTimeSkewFactorMs))) { _.head.response.result shouldBe Some(testResult) } @@ -187,7 +187,7 @@ abstract class WskRuleTests extends TestHelpers with WskTestHelpers { withActivationsFromEntity( wsk.activation, - actionName, + pkgActionName, since = Some(triggerActivation.start.minusMillis(activationTimeSkewFactorMs))) { _.head.response.result shouldBe Some(testResult) } ---------------------------------------------------------------- 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