You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/01/11 01:38:31 UTC
[incubator-openwhisk] branch master updated: Fix heisenbug by using
the correct view. (#3175)
This is an automated email from the ASF dual-hosted git repository.
dubeejw 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 50c0142 Fix heisenbug by using the correct view. (#3175)
50c0142 is described below
commit 50c0142e9543b38ba2807b1c734c5af6c3116d72
Author: rodric rabbah <ro...@gmail.com>
AuthorDate: Wed Jan 10 20:38:28 2018 -0500
Fix heisenbug by using the correct view. (#3175)
---
.../scala/whisk/core/entity/WhiskActivation.scala | 2 +-
.../core/controller/test/ActivationsApiTests.scala | 7 +++++-
.../scala/whisk/core/database/test/DbUtils.scala | 26 +++++++++++++++++++---
3 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala b/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala
index cde7507..0525f50 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskActivation.scala
@@ -159,7 +159,7 @@ object WhiskActivation
* A view for activations in a namespace additionally keyed by action name
* (and package name if present) sorted by date.
*/
- private val filtersView = WhiskEntityQueries.view(filtersDdoc, collectionName)
+ val filtersView = WhiskEntityQueries.view(filtersDdoc, collectionName)
override implicit val serdes = jsonFormat13(WhiskActivation.apply)
diff --git a/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
index c36a7c1..edda225 100644
--- a/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
@@ -338,7 +338,12 @@ class ActivationsApiTests extends ControllerTestCommon with WhiskActivationsApi
}.toList
activationsInPackage foreach { put(activationStore, _) }
- waitOnView(activationStore, namespace.root, 4, WhiskActivation.view)
+ waitOnView(activationStore, namespace.addPath(EntityName("xyz")), activations.length, WhiskActivation.filtersView)
+ waitOnView(
+ activationStore,
+ namespace.addPath(EntityName("pkg")).addPath(EntityName("xyz")),
+ activationsInPackage.length,
+ WhiskActivation.filtersView)
whisk.utils.retry {
Get(s"$collectionPath?name=xyz") ~> Route.seal(routes(creds)) ~> check {
diff --git a/tests/src/test/scala/whisk/core/database/test/DbUtils.scala b/tests/src/test/scala/whisk/core/database/test/DbUtils.scala
index 6c87faf..62c705b 100644
--- a/tests/src/test/scala/whisk/core/database/test/DbUtils.scala
+++ b/tests/src/test/scala/whisk/core/database/test/DbUtils.scala
@@ -86,11 +86,31 @@ trait DbUtils extends TransactionCounter {
def waitOnView[Au](db: ArtifactStore[Au], namespace: EntityName, count: Int, view: View)(
implicit context: ExecutionContext,
transid: TransactionId,
- timeout: Duration) = {
+ timeout: Duration): Unit = waitOnViewImpl(db, namespace.asString, count, view)
+
+ /**
+ * Wait on a view to update with documents added to namespace. This uses retry above,
+ * where the step performs a direct db query to retrieve the view and check the count
+ * matches the given value.
+ */
+ def waitOnView[Au](db: ArtifactStore[Au], path: EntityPath, count: Int, view: View)(
+ implicit context: ExecutionContext,
+ transid: TransactionId,
+ timeout: Duration): Unit = waitOnViewImpl(db, path.asString, count, view)
+
+ /**
+ * Wait on a view to update with documents added to namespace. This uses retry above,
+ * where the step performs a direct db query to retrieve the view and check the count
+ * matches the given value.
+ */
+ private def waitOnViewImpl[Au](db: ArtifactStore[Au], key: String, count: Int, view: View)(
+ implicit context: ExecutionContext,
+ transid: TransactionId,
+ timeout: Duration): Unit = {
val success = retry(
() => {
- val startKey = List(namespace.asString)
- val endKey = List(namespace.asString, WhiskEntityQueries.TOP)
+ val startKey = List(key)
+ val endKey = List(key, WhiskEntityQueries.TOP)
db.query(view.name, startKey, endKey, 0, 0, false, true, false, StaleParameter.No) map { l =>
if (l.length != count) {
throw RetryOp()
--
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].