vvraskin closed pull request #3327: Add retries to rule tests to prevent race 
condition
URL: https://github.com/apache/incubator-openwhisk/pull/3327
 
 
   

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/WskRuleTests.scala 
b/tests/src/test/scala/system/basic/WskRuleTests.scala
index bd30bc7d68..3c66282ed0 100644
--- a/tests/src/test/scala/system/basic/WskRuleTests.scala
+++ b/tests/src/test/scala/system/basic/WskRuleTests.scala
@@ -29,6 +29,9 @@ import common.RuleActivationResult
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import java.time.Instant
+import scala.concurrent.duration._
+
+import whisk.utils.retry
 
 @RunWith(classOf[JUnitRunner])
 abstract class WskRuleTests extends TestHelpers with WskTestHelpers {
@@ -99,13 +102,15 @@ abstract class WskRuleTests extends TestHelpers with 
WskTestHelpers {
     statusPermutations.foreach {
       case (trigger, status) =>
         if (status == active) wsk.rule.enable(ruleName) else 
wsk.rule.disable(ruleName)
-        wsk.rule
-          .create(ruleName, trigger, actionName, update = true)
-          .stdout
-          .parseJson
-          .asJsObject
-          .fields
-          .get("status") shouldBe status
+        retry({
+          wsk.rule
+            .create(ruleName, trigger, actionName, update = true)
+            .stdout
+            .parseJson
+            .asJsObject
+            .fields
+            .get("status") shouldBe status
+        },5,Some(1.second))
         
wsk.rule.get(ruleName).stdout.parseJson.asJsObject.fields.get("status") 
shouldBe status
     }
   }


 

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

Reply via email to