cbickel closed pull request #3296: Bump swift test-timeout to 2 minutes.
URL: https://github.com/apache/incubator-openwhisk/pull/3296
 
 
   

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/common/WskTestHelpers.scala 
b/tests/src/test/scala/common/WskTestHelpers.scala
index 5784824366..c9073f60a6 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 b0b1fee50e..f43778f5e7 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"


 

----------------------------------------------------------------
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

Reply via email to