You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cb...@apache.org on 2018/02/16 14:37:07 UTC
[incubator-openwhisk] branch master updated: Bump swift
test-timeout to 2 minutes. (#3296)
This is an automated email from the ASF dual-hosted git repository.
cbickel 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 43a2a0f Bump swift test-timeout to 2 minutes. (#3296)
43a2a0f is described below
commit 43a2a0f92a65c1d0510c693fef77a774cabe29f7
Author: Markus Thömmes <ma...@me.com>
AuthorDate: Fri Feb 16 15:37:03 2018 +0100
Bump swift test-timeout to 2 minutes. (#3296)
- This test is prone to errors because compiling swift apparently is subject to a lot variance (seen up to 1 minute).
- Refactor of some test helpers.
---
tests/src/test/scala/common/WskTestHelpers.scala | 34 +++++++++++++++-------
.../scala/whisk/core/cli/test/Swift311Tests.scala | 2 +-
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/tests/src/test/scala/common/WskTestHelpers.scala b/tests/src/test/scala/common/WskTestHelpers.scala
index 5784824..c9073f6 100644
--- a/tests/src/test/scala/common/WskTestHelpers.scala
+++ b/tests/src/test/scala/common/WskTestHelpers.scala
@@ -223,16 +223,14 @@ trait WskTestHelpers extends Matchers {
totalWait: Duration)(check: ActivationResult => Unit)(implicit wskprops: WskProps): Unit = {
val id = activationId
val activation = wsk.waitForActivation(id, initialWait, pollPeriod, totalWait)
- if (activation.isLeft) {
- assert(false, s"error waiting for activation $id: ${activation.left.get}")
- } else
- try {
- check(activation.right.get.convertTo[ActivationResult])
- } catch {
- case error: Throwable =>
- println(s"check failed for activation $id: ${activation.right.get}")
- throw error
- }
+
+ activation match {
+ case Left(reason) => fail(s"error waiting for activation $id for $totalWait: $reason")
+ case Right(result) =>
+ withRethrowingPrint(s"check failed for activation $id: $result") {
+ check(result.convertTo[ActivationResult])
+ }
+ }
}
/**
@@ -282,6 +280,22 @@ trait WskTestHelpers extends Matchers {
}
}
+ /**
+ * Prints the given information iff the inner test fails. Rethrows the tests exception to get a meaningful
+ * stacktrace.
+ *
+ * @param information additional information to print
+ * @param test test to run
+ */
+ def withRethrowingPrint(information: String)(test: => Unit): Unit = {
+ try test
+ catch {
+ case error: Throwable =>
+ println(information)
+ throw error
+ }
+ }
+
def removeCLIHeader(response: String): String = {
if (response.contains("\n")) response.substring(response.indexOf("\n")) else response
}
diff --git a/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala b/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala
index b0b1fee..f43778f 100644
--- a/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/Swift311Tests.scala
@@ -35,7 +35,7 @@ class Swift311Tests extends TestHelpers with WskTestHelpers with Matchers {
implicit val wskprops = WskProps()
val wsk = new WskRest
- val activationPollDuration = 60 seconds
+ val activationPollDuration = 2.minutes
val defaultJsAction = Some(TestUtils.getTestActionFilename("hello.js"))
lazy val runtimeContainer = "swift:3.1.1"
--
To stop receiving notification emails like this one, please contact
cbickel@apache.org.