You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ma...@apache.org on 2018/03/02 22:14:19 UTC
[incubator-openwhisk] branch master updated: Add retries to some
entity "update" tests. (#3364)
This is an automated email from the ASF dual-hosted git repository.
markusthoemmes 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 3d8b3ab Add retries to some entity "update" tests. (#3364)
3d8b3ab is described below
commit 3d8b3abe1d90689314f5a7ed49e5c7b2ec0c778a
Author: Mark Deuser <md...@us.ibm.com>
AuthorDate: Fri Mar 2 17:14:17 2018 -0500
Add retries to some entity "update" tests. (#3364)
---
.../test/scala/system/basic/WskBasicTests.scala | 38 +++++++++++++++++-----
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskBasicTests.scala
index 1fd93fd..9d9b0d6 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -53,6 +53,11 @@ class WskBasicTests extends TestHelpers with WskTestHelpers {
*/
def withTimestamp(text: String) = s"${text}-${System.currentTimeMillis}"
+ /**
+ * Retry operations that need to settle the controller cache
+ */
+ def cacheRetry[T](fn: => T) = whisk.utils.retry(fn, 5, Some(1.second))
+
behavior of "Wsk REST"
it should "reject creating duplicate entity" in withAssetCleaner(wskprops) { (wp, assetHelper) =>
@@ -88,9 +93,14 @@ class WskBasicTests extends TestHelpers with WskTestHelpers {
pkg.create(name, parameters = params, shared = Some(true))
pkg.create(name, update = true)
}
- val pack = wsk.pkg.get(name)
+
+ // Add retry to ensure cache with "0.0.1" is replaced
+ val pack = cacheRetry({
+ val p = wsk.pkg.get(name)
+ p.getField("version") shouldBe "0.0.2"
+ p
+ })
pack.getFieldJsValue("publish") shouldBe JsBoolean(true)
- pack.getField("version") shouldBe "0.0.2"
pack.getFieldJsValue("parameters") shouldBe JsArray(JsObject("key" -> JsString("a"), "value" -> JsString("A")))
val packageList = wsk.pkg.list()
val packages = packageList.getBodyListJsObject()
@@ -220,10 +230,14 @@ class WskBasicTests extends TestHelpers with WskTestHelpers {
action.create(name, None, parameters = Map("b" -> "B".toJson), update = true)
}
- val action = wsk.action.get(name)
+ // Add retry to ensure cache with "0.0.1" is replaced
+ val action = cacheRetry({
+ val a = wsk.action.get(name)
+ a.getField("version") shouldBe "0.0.2"
+ a
+ })
action.getFieldJsValue("parameters") shouldBe JsArray(JsObject("key" -> JsString("b"), "value" -> JsString("B")))
action.getFieldJsValue("publish") shouldBe JsBoolean(false)
- action.getField("version") shouldBe "0.0.2"
val actionList = wsk.action.list()
val actions = actionList.getBodyListJsObject()
actions.exists(action => RestResult.getField(action, "name") == name) shouldBe true
@@ -509,10 +523,14 @@ class WskBasicTests extends TestHelpers with WskTestHelpers {
rule.create(name, trigger = triggerName, action = actionName)
}
- val trigger = wsk.trigger.get(triggerName)
+ // Add retry to ensure cache with "0.0.1" is replaced
+ val trigger = cacheRetry({
+ val t = wsk.trigger.get(triggerName)
+ t.getField("version") shouldBe "0.0.2"
+ t
+ })
trigger.getFieldJsValue("parameters") shouldBe JsArray(JsObject("key" -> JsString("a"), "value" -> JsString("A")))
trigger.getFieldJsValue("publish") shouldBe JsBoolean(false)
- trigger.getField("version") shouldBe "0.0.2"
val expectedRules = JsObject(
ns + "/" + ruleName -> JsObject(
@@ -836,8 +854,12 @@ class WskBasicTests extends TestHelpers with WskTestHelpers {
// finally, we perform the update, and expect success this time
wsk.rule.create(ruleName, trigger = triggerName, action = actionName, update = true)
- val rule = wsk.rule.get(ruleName)
- rule.getField("version") shouldBe "0.0.2"
+ // Add retry to ensure cache with "0.0.1" is replaced
+ val rule = cacheRetry({
+ val r = wsk.rule.get(ruleName)
+ r.getField("version") shouldBe "0.0.2"
+ r
+ })
rule.getField("name") shouldBe ruleName
RestResult.getField(rule.getFieldJsObject("trigger"), "name") shouldBe triggerName
RestResult.getField(rule.getFieldJsObject("action"), "name") shouldBe actionName
--
To stop receiving notification emails like this one, please contact
markusthoemmes@apache.org.