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/22 12:04:17 UTC

[incubator-openwhisk] branch master updated: Add retry in updating-rule-test. (#3322)

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 994fbe8  Add retry in updating-rule-test. (#3322)
994fbe8 is described below

commit 994fbe8df3e82ead318d8df893393bfaa859dc49
Author: Markus Thömmes <ma...@me.com>
AuthorDate: Thu Feb 22 13:04:15 2018 +0100

    Add retry in updating-rule-test. (#3322)
    
    Updating a rule causes a cache-invalidation, which needs to propagate to other controllers before a subsequent get is guaranteed to yield the correct result.
---
 .../src/test/scala/system/basic/WskRuleTests.scala | 26 +++++++++++++++-------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/tests/src/test/scala/system/basic/WskRuleTests.scala b/tests/src/test/scala/system/basic/WskRuleTests.scala
index bd30bc7..c0fc9d0 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))
     }
   }
 

-- 
To stop receiving notification emails like this one, please contact
cbickel@apache.org.