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/21 11:43:01 UTC

[GitHub] csantanapr closed pull request #3167: Remove API for listing all entities in namespace

csantanapr closed pull request #3167: Remove API for listing all entities in namespace
URL: https://github.com/apache/incubator-openwhisk/pull/3167
 
 
   

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/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
index 7eaf1a10da..68d2fea38e 100644
--- a/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/WhiskStore.scala
@@ -162,33 +162,19 @@ protected[core] class View(ddoc: String, view: String) {
  * This object provides some utilities that query the whisk datastore.
  * The datastore is assumed to have views (pre-computed joins or indexes)
  * for each of the whisk collection types. Entities may be queries by
- * [namespace, date, name] where
+ * [path, date] where
  *
- * - namespace is the either root namespace for an entity (the owning subject
+ * - path is the either root namespace for an entity (the owning subject
  *   or organization) or a packaged qualified namespace,
  * - date is the date the entity was created or last updated, or for activations
  *   this is the start of the activation. See EntityRecord for the last updated
  *   property.
- * - name is the actual name of the entity (its simple name, not qualified by
- *   a package name)
  *
  * This order is important because the datastore is assumed to sort lexicographically
  * and hence either the fields are ordered according to the set of queries that are
  * desired: all entities in a namespace (by type), further refined by date, further
  * refined by name.
  *
- * In addition, for entities that may be queried across namespaces (currently
- * packages only), there must be a view which omits the namespace from the key,
- * as in [date, name] only. This permits the same queries that work for a collection
- * in a namespace to also work across namespaces.
- *
- * It is also assumed that the "-all" views implement a meaningful reduction for the
- * collection. Namely, the packages-all view will reduce the results to packages that
- * are public.
- *
- * The names of the views are assumed to be either the collection name, or
- * the collection name suffixed with "-all" per the method viewname. All of
- * the required views are installed by wipeTransientDBs.sh.
  */
 object WhiskEntityQueries {
   val TOP = "\ufff0"
@@ -198,34 +184,6 @@ object WhiskEntityQueries {
 
   /** The view name for the collection, within the design document. */
   def view(ddoc: String = designDoc, collection: String) = new View(ddoc, collection)
-
-  /**
-   * Name of view in design-doc that lists all entities in that views regardless of types.
-   * This is uses in the namespace API, and also in tests to check preconditions.
-   */
-  lazy val viewAll: View = view(ddoc = s"all-$designDoc", collection = "all")
-
-  /**
-   * Queries the datastore for all entities in a namespace, and converts the list of entities
-   * to a map that collects the entities by their type. This method applies to only to the main
-   * asset database, not the activations records because it does not offer the required view.
-   */
-  def listAllInNamespace[A <: WhiskEntity](
-    db: ArtifactStore[A],
-    namespace: EntityName,
-    includeDocs: Boolean,
-    stale: StaleParameter = StaleParameter.No)(implicit transid: TransactionId): Future[Map[String, List[JsObject]]] = {
-    implicit val ec = db.executionContext
-    val startKey = List(namespace.asString)
-    val endKey = List(namespace.asString, TOP)
-    db.query(viewAll.name, startKey, endKey, 0, 0, includeDocs, descending = true, reduce = false, stale = stale) map {
-      _ map { row =>
-        val value = row.fields("value").asJsObject
-        val JsString(collection) = value.fields("collection")
-        (collection, JsObject(value.fields.filterNot { _._1 == "collection" }))
-      } groupBy { _._1 } mapValues { _.map(_._2) }
-    }
-  }
 }
 
 trait WhiskEntityQueries[T] {
diff --git a/core/controller/src/main/resources/apiv1swagger.json b/core/controller/src/main/resources/apiv1swagger.json
index 86e946081a..c53068cbb5 100644
--- a/core/controller/src/main/resources/apiv1swagger.json
+++ b/core/controller/src/main/resources/apiv1swagger.json
@@ -60,74 +60,6 @@
                 }
             }
         },
-        "/namespaces/{namespace}": {
-            "get": {
-                "tags": [
-                    "Namespaces"
-                ],
-                "description": "Get all entities in a namespace",
-                "summary": "Get all entities in a namespace",
-                "operationId": "getAllEntitiesInNamespace",
-                "parameters": [
-                    {
-                        "name": "namespace",
-                        "in": "path",
-                        "description": "The namespace",
-                        "required": true,
-                        "type": "string"
-                    }
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "responses": {
-                    "200": {
-                        "description": "All entities",
-                        "schema": {
-                            "type": "object",
-                            "required": [
-                                "actions",
-                                "triggers",
-                                "rules",
-                                "packages"
-                            ],
-                            "properties": {
-                                "actions": {
-                                    "type": "array",
-                                    "items": {
-                                        "$ref": "#/definitions/EntityBrief"
-                                    }
-                                },
-                                "triggers": {
-                                    "type": "array",
-                                    "items": {
-                                        "$ref": "#/definitions/EntityBrief"
-                                    }
-                                },
-                                "rules": {
-                                    "type": "array",
-                                    "items": {
-                                        "$ref": "#/definitions/EntityBrief"
-                                    }
-                                },
-                                "packages": {
-                                    "type": "array",
-                                    "items": {
-                                        "$ref": "#/definitions/EntityBrief"
-                                    }
-                                }
-                            }
-                        }
-                    },
-                    "401": {
-                        "$ref": "#/responses/UnauthorizedRequest"
-                    },
-                    "500": {
-                        "$ref": "#/responses/ServerError"
-                    }
-                }
-            }
-        },
         "/namespaces/{namespace}/actions": {
             "get": {
                 "tags": [
diff --git a/core/controller/src/main/scala/whisk/core/controller/Namespaces.scala b/core/controller/src/main/scala/whisk/core/controller/Namespaces.scala
index b1c407af10..0afbb4037c 100644
--- a/core/controller/src/main/scala/whisk/core/controller/Namespaces.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/Namespaces.scala
@@ -17,38 +17,18 @@
 
 package whisk.core.controller
 
-import scala.concurrent.Future
-import scala.util.Failure
-import scala.util.Success
 import akka.http.scaladsl.model.StatusCodes._
 import akka.http.scaladsl.server.Directives
-import akka.http.scaladsl.server.RequestContext
-import akka.http.scaladsl.server.RouteResult
 import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
 import spray.json.DefaultJsonProtocol._
 import whisk.common.TransactionId
-import whisk.core.entitlement.{Collection, Privilege, Resource}
-import whisk.core.entitlement.Privilege.READ
-import whisk.core.entity.EntityPath
+import whisk.core.entitlement.Collection
 import whisk.core.entity.Identity
-import whisk.core.entity.WhiskAction
-import whisk.core.entity.WhiskEntityQueries.listAllInNamespace
-import whisk.core.entity.WhiskPackage
-import whisk.core.entity.WhiskRule
-import whisk.core.entity.WhiskTrigger
-import whisk.core.entity.types.EntityStore
-import whisk.http.ErrorResponse.terminate
 
-trait WhiskNamespacesApi
-    extends Directives
-    with AuthenticatedRouteProvider
-    with BasicAuthorizedRouteProvider
-    with ReadOps {
+trait WhiskNamespacesApi extends Directives with AuthenticatedRouteProvider {
 
-  protected override val collection = Collection(Collection.NAMESPACES)
-
-  /** Database service to lookup entities in a namespace. */
-  protected val entityStore: EntityStore
+  protected val collection = Collection(Collection.NAMESPACES)
+  protected val collectionOps = pathEndOrSingleSlash & get
 
   /** JSON response formatter. */
   import RestApiCommons.jsonDefaultResponsePrinter
@@ -56,76 +36,13 @@ trait WhiskNamespacesApi
   /**
    * Rest API for managing namespaces. Defines all the routes handled by this API. They are:
    *
-   * GET  namespaces[/] -- gets namespaces for authenticated user
-   * GET  namespaces/_[/] -- gets all entities in implicit namespace
-   * GET  namespaces/namespace[/] -- gets all entities in explicit namespace
+   * GET  namespaces[/] -- gets namespace for authenticated user
    *
    * @param user the authenticated user for this route
    */
   override def routes(user: Identity)(implicit transid: TransactionId) = {
-    pathPrefix(collection.path) {
-      (collectionOps & requestMethod) { m =>
-        getNamespaces(user)
-      } ~ (entityOps & entityPrefix & pathEndOrSingleSlash & requestMethod) { (segment, m) =>
-        namespace(user, segment) { ns =>
-          val resource = Resource(ns, collection, None)
-          authorizeAndDispatch(m, user, resource)
-        }
-      }
-    }
-  }
-
-  /**
-   * GET  / -- gets namespaces for authenticated user
-   * GET  /namespace -- gets all entities in namespace
-   *
-   * The namespace of the resource is derived from the authenticated user. The
-   * resource entity name, if it is defined, may be a different namespace.
-   */
-  protected override def dispatchOp(user: Identity, op: Privilege, resource: Resource)(
-    implicit transid: TransactionId) = {
-    resource.entity match {
-      case None if op == READ => getAllInNamespace(resource.namespace)
-      case _                  => reject // should not get here
-    }
-  }
-
-  /**
-   * Gets all entities in namespace.
-   *
-   * Responses are one of (Code, Message)
-   * - 200 Map [ String (collection name), List[EntitySummary] ] as JSON
-   * - 500 Internal Server Error
-   */
-  private def getAllInNamespace(namespace: EntityPath)(
-    implicit transid: TransactionId): RequestContext => Future[RouteResult] = {
-    onComplete(listAllInNamespace(entityStore, namespace.root, false)) {
-      case Success(entities) => {
-        complete(OK, Namespaces.emptyNamespace ++ entities)
-      }
-      case Failure(t) =>
-        logging.error(this, s"[GET] namespaces failed: ${t.getMessage}")
-        terminate(InternalServerError)
+    (pathPrefix(collection.path) & collectionOps) {
+      complete(OK, List(user.namespace))
     }
   }
-
-  /**
-   * Gets namespaces for subject from entitlement service.
-   *
-   * Responses are one of (Code, Message)
-   * - 200 [ Namespaces (as String) ] as JSON
-   * - 401 Unauthorized
-   * - 500 Internal Server Error
-   */
-  private def getNamespaces(user: Identity)(implicit transid: TransactionId) = {
-    complete(OK, List(user.namespace))
-  }
-}
-
-object Namespaces {
-  val emptyNamespace = Map(
-    WhiskAction.collectionName -> List(),
-    WhiskPackage.collectionName -> List(),
-    WhiskRule.collectionName -> List(),
-    WhiskTrigger.collectionName -> List())
 }
diff --git a/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala b/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala
index 161ef4bc38..cc9158d535 100644
--- a/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala
+++ b/core/controller/src/main/scala/whisk/core/controller/RestAPIs.scala
@@ -229,12 +229,7 @@ class RestAPIVersion(config: WhiskConfig, apiPath: String, apiVersion: String)(
   private val rules = new RulesApi(apiPath, apiVersion)
   private val web = new WebActionsApi(Seq("web"), new WebApiDirectives())
 
-  class NamespacesApi(val apiPath: String, val apiVersion: String)(
-    implicit override val entityStore: EntityStore,
-    override val entitlementProvider: EntitlementProvider,
-    override val executionContext: ExecutionContext,
-    override val logging: Logging)
-      extends WhiskNamespacesApi
+  class NamespacesApi(val apiPath: String, val apiVersion: String) extends WhiskNamespacesApi
 
   class ActionsApi(val apiPath: String, val apiVersion: String)(
     implicit override val actorSystem: ActorSystem,
diff --git a/tests/src/test/scala/common/BaseWsk.scala b/tests/src/test/scala/common/BaseWsk.scala
index 775bfe03cb..228ef4044b 100644
--- a/tests/src/test/scala/common/BaseWsk.scala
+++ b/tests/src/test/scala/common/BaseWsk.scala
@@ -304,9 +304,6 @@ trait BaseNamespace extends BaseRunWsk {
   def list(expectedExitCode: Int = SUCCESS_EXIT, nameSort: Option[Boolean] = None)(implicit wp: WskProps): RunResult
 
   def whois()(implicit wskprops: WskProps): String
-
-  def get(namespace: Option[String] = None, expectedExitCode: Int, nameSort: Option[Boolean] = None)(
-    implicit wp: WskProps): RunResult
 }
 
 trait BaseApi extends BaseRunWsk {
diff --git a/tests/src/test/scala/common/Wsk.scala b/tests/src/test/scala/common/Wsk.scala
index 1192e6eebf..44d5c95789 100644
--- a/tests/src/test/scala/common/Wsk.scala
+++ b/tests/src/test/scala/common/Wsk.scala
@@ -716,7 +716,7 @@ class WskNamespace() extends RunWskCmd with FullyQualifiedNames with BaseNamespa
   protected val noun = "namespace"
 
   /**
-   * Lists available namespaces for whisk properties.
+   * Lists available namespaces for whisk key.
    *
    * @param expectedExitCode (optional) the expected exit code for the command
    * if the code is anything but DONTCARE_EXIT, assert the code is as expected
@@ -751,7 +751,7 @@ class WskNamespace() extends RunWskCmd with FullyQualifiedNames with BaseNamespa
    * @param expectedExitCode (optional) the expected exit code for the command
    * if the code is anything but DONTCARE_EXIT, assert the code is as expected
    */
-  override def get(namespace: Option[String] = None, expectedExitCode: Int, nameSort: Option[Boolean] = None)(
+  def get(namespace: Option[String] = None, expectedExitCode: Int, nameSort: Option[Boolean] = None)(
     implicit wp: WskProps): RunResult = {
     val params = {
       nameSort map { n =>
diff --git a/tests/src/test/scala/common/rest/WskRest.scala b/tests/src/test/scala/common/rest/WskRest.scala
index 4934b8ec42..4755565290 100644
--- a/tests/src/test/scala/common/rest/WskRest.scala
+++ b/tests/src/test/scala/common/rest/WskRest.scala
@@ -836,7 +836,7 @@ class WskRestNamespace extends RunWskRestCmd with BaseNamespace {
   protected val noun = "namespaces"
 
   /**
-   * Lists available namespaces for whisk properties.
+   * Lists available namespaces for whisk key.
    *
    * @param expectedExitCode (optional) the expected exit code for the command
    * if the code is anything but DONTCARE_EXIT, assert the code is as expected
@@ -850,24 +850,6 @@ class WskRestNamespace extends RunWskRestCmd with BaseNamespace {
     result
   }
 
-  /**
-   * Gets entities in namespace.
-   *
-   * @param namespace (optional) if specified must be  fully qualified namespace
-   * @param expectedExitCode (optional) the expected exit code for the command
-   * if the code is anything but DONTCARE_EXIT, assert the code is as expected
-   */
-  override def get(namespace: Option[String] = None,
-                   expectedExitCode: Int = OK.intValue,
-                   nameSort: Option[Boolean] = None)(implicit wp: WskProps): RestResult = {
-    val (ns, _) = namespace map { this.getNamespaceEntityName(_) } getOrElse (wp.namespace, "")
-    val entPath = Path(s"$basePath/namespaces/$ns/")
-    val resp = requestEntity(GET, entPath)
-    val r = new RestResult(resp.status, getRespData(resp))
-    validateStatusCode(expectedExitCode, r.statusCode.intValue)
-    r
-  }
-
   /**
    * Looks up namespace for whisk props.
    *
diff --git a/tests/src/test/scala/services/HeadersTests.scala b/tests/src/test/scala/services/HeadersTests.scala
index f3184c87f1..ab3792ccd0 100644
--- a/tests/src/test/scala/services/HeadersTests.scala
+++ b/tests/src/test/scala/services/HeadersTests.scala
@@ -196,22 +196,6 @@ class HeadersTests extends FlatSpec with Matchers with ScalaFutures with WskActo
     containsHeaders(response.headers, Some(Set("GET")))
   }
 
-  it should "respond to OPTIONS for namespaces getEntities" in {
-    val path = basePath / "namespaces" / "barfoo"
-    val response = request(OPTIONS, url.withPath(path)).futureValue
-
-    response.status shouldBe OK
-    containsHeaders(response.headers, Some(Set("GET")))
-  }
-
-  it should "respond to GET for namespaces getEntities with Headers" in {
-    val path = basePath / "namespaces" / "_"
-    val response = request(GET, url.withPath(path), Some(List(Authorization(creds)))).futureValue
-
-    response.status shouldBe OK
-    containsHeaders(response.headers)
-  }
-
   // Packages
   it should "respond to OPTIONS for listing packages" in {
     val path = basePath / "namespaces" / "barfoo" / "packages"
diff --git a/tests/src/test/scala/system/basic/WskBasicNode6Tests.scala b/tests/src/test/scala/system/basic/WskBasicNode6Tests.scala
index a97636f701..f4a04e3a2e 100644
--- a/tests/src/test/scala/system/basic/WskBasicNode6Tests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicNode6Tests.scala
@@ -37,7 +37,7 @@ abstract class WskBasicNode6Tests extends TestHelpers with WskTestHelpers with J
   val defaultAction = Some(TestUtils.getTestActionFilename("hello.js"))
   lazy val currentNodeJsKind = "nodejs:6"
 
-  behavior of "Runtime $currentNodeJsKind"
+  behavior of s"Runtime $currentNodeJsKind"
 
   it should "Ensure that NodeJS actions can have a non-default entrypoint" in withAssetCleaner(wskprops) {
     (wp, assetHelper) =>
diff --git a/tests/src/test/scala/whisk/core/controller/test/NamespacesApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/NamespacesApiTests.scala
index 39e0107317..4cb20275f5 100644
--- a/tests/src/test/scala/whisk/core/controller/test/NamespacesApiTests.scala
+++ b/tests/src/test/scala/whisk/core/controller/test/NamespacesApiTests.scala
@@ -21,21 +21,14 @@ import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 
 import akka.http.scaladsl.model.StatusCodes.OK
-import akka.http.scaladsl.model.StatusCodes.Forbidden
-import akka.http.scaladsl.model.StatusCodes.MethodNotAllowed
+import akka.http.scaladsl.model.StatusCodes.NotFound
 import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport.sprayJsonUnmarshaller
 import akka.http.scaladsl.server.Route
 
 import spray.json.DefaultJsonProtocol._
-import spray.json._
 
-import whisk.core.controller.Namespaces
 import whisk.core.controller.WhiskNamespacesApi
 import whisk.core.entity.EntityPath
-import spray.json.JsObject
-import spray.json.JsObject
-import whisk.core.controller.Namespaces
-import spray.json.JsArray
 
 /**
  * Tests Namespaces API.
@@ -61,59 +54,21 @@ class NamespacesApiTests extends ControllerTestCommon with WhiskNamespacesApi {
 
   it should "list namespaces for subject" in {
     implicit val tid = transid()
-    Get(collectionPath) ~> Route.seal(routes(creds)) ~> check {
-      status should be(OK)
-      val ns = responseAs[List[EntityPath]]
-      ns should be(List(EntityPath(creds.subject.asString)))
+    Seq("", "/").foreach { p =>
+      Get(collectionPath + p) ~> Route.seal(routes(creds)) ~> check {
+        status should be(OK)
+        val ns = responseAs[List[EntityPath]]
+        ns should be(List(EntityPath(creds.subject.asString)))
+      }
     }
   }
 
-  it should "list namespaces for subject with trailing /" in {
+  it should "reject request for unsupported method" in {
     implicit val tid = transid()
-    Get(s"$collectionPath/") ~> Route.seal(routes(creds)) ~> check {
-      status should be(OK)
-      val ns = responseAs[List[EntityPath]]
-      ns should be(List(EntityPath(creds.subject.asString)))
-    }
-  }
-
-  it should "get namespace entities for subject" in {
-    implicit val tid = transid()
-    Get(s"$collectionPath/${creds.subject}") ~> Route.seal(routes(creds)) ~> check {
-      status should be(OK)
-      val ns = responseAs[JsObject]
-      ns should be(JsObject(Namespaces.emptyNamespace map { kv =>
-        (kv._1, JsArray())
-      }))
-    }
-  }
-
-  it should "reject get namespace entities for unauthorized subject" in {
-    implicit val tid = transid()
-    val anothercred = WhiskAuthHelpers.newIdentity()
-    Get(s"$collectionPath/${anothercred.subject}") ~> Route.seal(routes(creds)) ~> check {
-      status should be(Forbidden)
-    }
-  }
-
-  it should "reject request with put" in {
-    implicit val tid = transid()
-    Put(s"$collectionPath/${creds.subject}") ~> Route.seal(routes(creds)) ~> check {
-      status should be(MethodNotAllowed)
-    }
-  }
-
-  it should "reject request with post" in {
-    implicit val tid = transid()
-    Post(s"$collectionPath/${creds.subject}") ~> Route.seal(routes(creds)) ~> check {
-      status should be(MethodNotAllowed)
-    }
-  }
-
-  it should "reject request with delete" in {
-    implicit val tid = transid()
-    Delete(s"$collectionPath/${creds.subject}") ~> Route.seal(routes(creds)) ~> check {
-      status should be(MethodNotAllowed)
+    Seq(Get, Put, Post, Delete).foreach { m =>
+      m(s"$collectionPath/${creds.subject}") ~> Route.seal(routes(creds)) ~> check {
+        status should be(NotFound)
+      }
     }
   }
 }
diff --git a/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala b/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala
index 63f720d024..ae4e509a93 100644
--- a/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala
+++ b/tests/src/test/scala/whisk/core/entity/test/ViewTests.scala
@@ -34,7 +34,6 @@ import whisk.core.database.ArtifactStore
 import whisk.core.database.StaleParameter
 import whisk.core.database.test.DbUtils
 import whisk.core.entity._
-import whisk.core.entity.WhiskEntityQueries._
 
 @RunWith(classOf[JUnitRunner])
 class ViewTests
@@ -83,17 +82,6 @@ class ViewTests
 
   behavior of "Datastore View"
 
-  def getEntitiesInNamespace[Au <: WhiskEntity](entityStore: ArtifactStore[Au], ns: EntityPath)(
-    implicit entities: Seq[WhiskEntity]) = {
-    implicit val tid = transid()
-    val map = Await.result(listAllInNamespace(entityStore, ns.root, false, StaleParameter.No), dbOpTimeout)
-    val result = map.values.toList.flatten
-    val expected = entities filter (_.namespace.root.toPath == ns)
-    map.get(WhiskActivation.collectionName) should be(None)
-    result should have length expected.length
-    result should contain theSameElementsAs expected.map(_.summaryAsJson)
-  }
-
   def getAllActivationsInNamespace[Au <: WhiskEntity](store: ArtifactStore[Au], ns: EntityPath)(
     implicit entities: Seq[WhiskEntity]) = {
     implicit val tid = transid()
@@ -228,15 +216,6 @@ class ViewTests
     val actionName = aname()
     def now = Instant.now(Clock.systemUTC())
 
-    // creates 17 entities in each namespace as follows:
-    // - 2 actions in each namespace in the default namespace
-    // - 2 actions in the same package within a namespace
-    // - 1 action in two different packages in the same namespace
-    // - 1 action in package with prescribed name
-    // - 2 triggers in each namespace
-    // - 2 rules in each namespace
-    // - 2 packages in each namespace
-    // - 2 package bindings in each namespace
     implicit val entities = Seq(
       WhiskAction(namespace1, aname(), exec),
       WhiskAction(namespace1, aname(), exec),
@@ -269,10 +248,15 @@ class ViewTests
       WhiskPackage(namespace2, aname(), Some(Binding(namespace1.root, aname()))))
 
     entities foreach { put(entityStore, _) }
-    waitOnView(entityStore, namespace1.root, 15, WhiskEntityQueries.viewAll)
-    waitOnView(entityStore, namespace2.root, 14, WhiskEntityQueries.viewAll)
+    waitOnView(entityStore, namespace1.root, 7, WhiskAction.view)
+    waitOnView(entityStore, namespace1.root, 2, WhiskTrigger.view)
+    waitOnView(entityStore, namespace1.root, 2, WhiskRule.view)
+    waitOnView(entityStore, namespace1.root, 4, WhiskPackage.view)
+    waitOnView(entityStore, namespace2.root, 6, WhiskAction.view)
+    waitOnView(entityStore, namespace2.root, 2, WhiskTrigger.view)
+    waitOnView(entityStore, namespace2.root, 2, WhiskRule.view)
+    waitOnView(entityStore, namespace2.root, 4, WhiskPackage.view)
 
-    getEntitiesInNamespace(entityStore, namespace1)
     getKindInNamespace(entityStore, namespace1, "actions", {
       case (e: WhiskAction) => true
       case (_)              => false
@@ -298,7 +282,6 @@ class ViewTests
       case (_)              => false
     })
 
-    getEntitiesInNamespace(entityStore, namespace2)
     getKindInNamespace(entityStore, namespace2, "actions", {
       case (e: WhiskAction) => true
       case (_)              => false
@@ -425,7 +408,7 @@ class ViewTests
       })
   }
 
-  it should "query whisk and retrieve full documents" in {
+  it should "list actions and retrieve full documents" in {
     implicit val tid = transid()
     val actionName = aname()
     val now = Instant.now(Clock.systemUTC())
@@ -433,7 +416,8 @@ class ViewTests
       Seq(WhiskAction(namespace1, aname(), jsDefault("??")), WhiskAction(namespace1, aname(), jsDefault("??")))
 
     entities foreach { put(entityStore, _) }
-    waitOnView(entityStore, namespace1.root, entities.length, WhiskEntityQueries.viewAll)
+    waitOnView(entityStore, namespace1.root, 2, WhiskAction.view)
+
     getKindInNamespaceWithDoc[WhiskAction](namespace1, "actions", {
       case (e: WhiskAction) => true
       case (_)              => false


 

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