You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/22 12:04:18 UTC

[GitHub] cbickel closed pull request #3322: Add retry in updating-rule-test.

cbickel closed pull request #3322: Add retry in updating-rule-test.
URL: https://github.com/apache/incubator-openwhisk/pull/3322
 
 
   

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..c0fc9d020e 100644
--- a/tests/src/test/scala/system/basic/WskRuleTests.scala
+++ b/tests/src/test/scala/system/basic/WskRuleTests.scala
@@ -29,6 +29,8 @@ import common.RuleActivationResult
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import java.time.Instant
+import whisk.utils.retry
+import scala.concurrent.duration._
 
 @RunWith(classOf[JUnitRunner])
 abstract class WskRuleTests extends TestHelpers with WskTestHelpers {
@@ -99,14 +101,22 @@ 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
-        wsk.rule.get(ruleName).stdout.parseJson.asJsObject.fields.get("status") shouldBe status
+
+        // Needs to be retried since the enable/disable causes a cache invalidation which needs to propagate first
+        retry(
+          {
+            wsk.rule
+              .create(ruleName, trigger, actionName, update = true)
+              .stdout
+              .parseJson
+              .asJsObject
+              .fields
+              .get("status") shouldBe status
+
+            wsk.rule.get(ruleName).stdout.parseJson.asJsObject.fields.get("status") shouldBe status
+          },
+          10,
+          Some(1.second))
     }
   }
 


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services