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/09/20 01:14:21 UTC
[GitHub] jiangpengcheng closed pull request #4031: Add common test codes for
ActivationStore
jiangpengcheng closed pull request #4031: Add common test codes for ActivationStore
URL: https://github.com/apache/incubator-openwhisk/pull/4031
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/whisk/core/database/ArtifactActivationStoreBehaviorBase.scala b/tests/src/test/scala/whisk/core/database/ArtifactActivationStoreBehaviorBase.scala
new file mode 100644
index 0000000000..e82f07c5a9
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/database/ArtifactActivationStoreBehaviorBase.scala
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database
+
+import akka.stream.ActorMaterializer
+import org.scalatest.FlatSpec
+import whisk.core.controller.test.WhiskAuthHelpers
+import whisk.core.database.test.behavior.ActivationStoreBehaviorBase
+
+trait ArtifactActivationStoreBehaviorBase extends FlatSpec with ActivationStoreBehaviorBase {
+ override def storeType = "Artifact"
+
+ override val context = UserContext(WhiskAuthHelpers.newIdentity())
+
+ override lazy val activationStore = {
+ ArtifactActivationStoreProvider.instance(actorSystem, ActorMaterializer.create(actorSystem), logging)
+ }
+}
diff --git a/tests/src/test/scala/whisk/core/database/ArtifactActivationStoreTests.scala b/tests/src/test/scala/whisk/core/database/ArtifactActivationStoreTests.scala
new file mode 100644
index 0000000000..ad74723bca
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/database/ArtifactActivationStoreTests.scala
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database
+
+import java.time.Instant
+
+import org.junit.runner.RunWith
+import org.scalatest.FlatSpec
+import org.scalatest.junit.JUnitRunner
+import whisk.common.TransactionId
+import whisk.core.database.test.behavior.ActivationStoreBehavior
+import whisk.core.entity.{EntityPath, WhiskActivation}
+import whisk.utils.retry
+
+@RunWith(classOf[JUnitRunner])
+class ArtifactActivationStoreTests
+ extends FlatSpec
+ with ArtifactActivationStoreBehaviorBase
+ with ActivationStoreBehavior {
+ override def checkQueryActivations(namespace: String,
+ name: Option[String] = None,
+ skip: Int = 0,
+ limit: Int = 1000,
+ includeDocs: Boolean = false,
+ since: Option[Instant] = None,
+ upto: Option[Instant] = None,
+ context: UserContext,
+ expected: IndexedSeq[WhiskActivation])(implicit transid: TransactionId): Unit = {
+ // This is for compatible with CouchDB as it use option `StaleParameter.UpdateAfter`
+ retry(super.checkQueryActivations(namespace, name, skip, limit, includeDocs, since, upto, context, expected), 5)
+ }
+
+ override def checkCountActivations(namespace: String,
+ name: Option[EntityPath] = None,
+ skip: Int = 0,
+ since: Option[Instant] = None,
+ upto: Option[Instant] = None,
+ context: UserContext,
+ expected: Long)(implicit transid: TransactionId): Unit = {
+ retry(super.checkCountActivations(namespace, name, skip, since, upto, context, expected), 5)
+ }
+}
diff --git a/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreBehavior.scala b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreBehavior.scala
new file mode 100644
index 0000000000..544f56405e
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreBehavior.scala
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database.test.behavior
+
+trait ActivationStoreBehavior
+ extends ActivationStoreBehaviorBase
+ with ActivationStoreCRUDBehaviors
+ with ActivationStoreQueryBehaviors
diff --git a/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreBehaviorBase.scala b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreBehaviorBase.scala
new file mode 100644
index 0000000000..87daa32ba1
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreBehaviorBase.scala
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database.test.behavior
+
+import java.time.Instant
+
+import akka.stream.ActorMaterializer
+import common.{StreamLogging, WskActorSystem}
+import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
+import org.scalatest.{BeforeAndAfterEach, FlatSpec, Matchers, Outcome}
+import whisk.common.TransactionId
+import whisk.core.database.test.behavior.ArtifactStoreTestUtil.storeAvailable
+import whisk.core.database._
+import whisk.core.entity._
+
+import scala.collection.mutable.ListBuffer
+import scala.concurrent.duration.{Duration, DurationInt}
+import scala.concurrent.Await
+import scala.language.postfixOps
+import scala.util.{Random, Try}
+
+trait ActivationStoreBehaviorBase
+ extends FlatSpec
+ with ScalaFutures
+ with Matchers
+ with StreamLogging
+ with WskActorSystem
+ with IntegrationPatience
+ with BeforeAndAfterEach {
+
+ protected implicit val materializer: ActorMaterializer = ActorMaterializer()
+ protected implicit val notifier: Option[CacheChangeNotification] = None
+
+ def context: UserContext
+ def activationStore: ActivationStore
+ private val docsToDelete = ListBuffer[(UserContext, ActivationId)]()
+
+ def storeType: String
+
+ protected def transId() = TransactionId(Random.alphanumeric.take(32).mkString)
+
+ override def afterEach(): Unit = {
+ cleanup()
+ stream.reset()
+ }
+
+ override protected def withFixture(test: NoArgTest): Outcome = {
+ assume(storeAvailable(storeAvailableCheck), s"$storeType not configured or available")
+ val outcome = super.withFixture(test)
+ if (outcome.isFailed) {
+ println(logLines.mkString("\n"))
+ }
+ outcome
+ }
+
+ protected def storeAvailableCheck: Try[Any] = Try(true)
+ //~----------------------------------------< utility methods >
+
+ protected def store(activation: WhiskActivation, context: UserContext)(
+ implicit transid: TransactionId,
+ notifier: Option[CacheChangeNotification]): DocInfo = {
+ val doc = activationStore.store(activation, context).futureValue
+ docsToDelete.append((context, ActivationId(activation.docid.asString)))
+ doc
+ }
+
+ protected def newActivation(ns: String, actionName: String, start: Long): WhiskActivation = {
+ WhiskActivation(
+ EntityPath(ns),
+ EntityName(actionName),
+ Subject(),
+ ActivationId.generate(),
+ Instant.ofEpochMilli(start),
+ Instant.ofEpochMilli(start + 1000))
+ }
+
+ /**
+ * Deletes all documents added to gc queue.
+ */
+ def cleanup()(implicit timeout: Duration = 10 seconds): Unit = {
+ implicit val tid = transId()
+ docsToDelete.map { e =>
+ Try {
+ Await.result(activationStore.delete(e._2, e._1), timeout)
+ }
+ }
+ docsToDelete.clear()
+ }
+
+}
diff --git a/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreCRUDBehaviors.scala b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreCRUDBehaviors.scala
new file mode 100644
index 0000000000..113f989ad5
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreCRUDBehaviors.scala
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database.test.behavior
+
+import whisk.common.TransactionId
+import whisk.core.database.NoDocumentException
+import whisk.core.entity._
+
+import scala.util.Random
+
+trait ActivationStoreCRUDBehaviors extends ActivationStoreBehaviorBase {
+
+ private val namespace = s"ns_${Random.alphanumeric.take(4).mkString}"
+ private val action = s"action1_${Random.alphanumeric.take(4).mkString}"
+
+ behavior of s"${storeType}ActivationStore store"
+
+ it should "put activation and get docinfo" in {
+ implicit val tid: TransactionId = transId()
+ val activation = newActivation(namespace, action, 1L)
+ val doc = store(activation, context)
+ doc shouldBe activation.docinfo
+ }
+
+ behavior of s"${storeType}ActivationStore delete"
+
+ it should "deletes existing activation" in {
+ implicit val tid: TransactionId = transId()
+ val activation = newActivation(namespace, action, 1L)
+ store(activation, context)
+ activationStore.delete(ActivationId(activation.docid.asString), context).futureValue shouldBe true
+ }
+
+ it should "throws NoDocumentException when activation does not exist" in {
+ implicit val tid: TransactionId = transId()
+ activationStore.delete(ActivationId("non-existing-doc"), context).failed.futureValue shouldBe a[NoDocumentException]
+ }
+
+ behavior of s"${storeType}ActivationStore get"
+
+ it should "get existing activation matching id" in {
+ implicit val tid: TransactionId = transId()
+ val activation = newActivation(namespace, action, 1L)
+ store(activation, context)
+ activationStore.get(ActivationId(activation.docid.asString), context).futureValue shouldBe activation
+ }
+
+ it should "throws NoDocumentException when activation does not exist" in {
+ implicit val tid: TransactionId = transId()
+ activationStore.get(ActivationId("non-existing-doc"), context).failed.futureValue shouldBe a[NoDocumentException]
+ }
+}
diff --git a/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreQueryBehaviors.scala b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreQueryBehaviors.scala
new file mode 100644
index 0000000000..046fdf7aa2
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/database/test/behavior/ActivationStoreQueryBehaviors.scala
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package whisk.core.database.test.behavior
+
+import java.time.Instant
+
+import spray.json.{JsNumber, JsObject}
+import whisk.common.TransactionId
+import whisk.core.database.UserContext
+import whisk.core.entity.{EntityPath, WhiskActivation}
+
+import scala.util.Random
+
+trait ActivationStoreQueryBehaviors extends ActivationStoreBehaviorBase {
+
+ private val namespace = s"ns_${Random.alphanumeric.take(4).mkString}"
+ private val action1 = s"action1_${Random.alphanumeric.take(4).mkString}"
+ private val action2 = s"action2_${Random.alphanumeric.take(4).mkString}"
+
+ protected def checkQueryActivations(namespace: String,
+ name: Option[String] = None,
+ skip: Int = 0,
+ limit: Int = 1000,
+ includeDocs: Boolean = false,
+ since: Option[Instant] = None,
+ upto: Option[Instant] = None,
+ context: UserContext,
+ expected: IndexedSeq[WhiskActivation])(implicit transid: TransactionId): Unit = {
+ val result =
+ name
+ .map { n =>
+ activationStore
+ .listActivationsMatchingName(
+ EntityPath(namespace),
+ EntityPath(n),
+ skip = skip,
+ limit = limit,
+ includeDocs = includeDocs,
+ since = since,
+ upto = upto,
+ context = context)
+ }
+ .getOrElse {
+ activationStore
+ .listActivationsInNamespace(
+ EntityPath(namespace),
+ skip = skip,
+ limit = limit,
+ includeDocs = includeDocs,
+ since = since,
+ upto = upto,
+ context = context)
+ }
+ .map { r =>
+ r.fold((left) => left, (right) => right.map(wa => if (includeDocs) wa.toExtendedJson else wa.summaryAsJson))
+ }
+ .futureValue
+
+ result should contain theSameElementsAs expected.map(wa =>
+ if (includeDocs) wa.toExtendedJson else wa.summaryAsJson)
+ }
+
+ protected def checkCountActivations(namespace: String,
+ name: Option[EntityPath] = None,
+ skip: Int = 0,
+ since: Option[Instant] = None,
+ upto: Option[Instant] = None,
+ context: UserContext,
+ expected: Long)(implicit transid: TransactionId): Unit = {
+ val result = activationStore
+ .countActivationsInNamespace(
+ EntityPath(namespace),
+ name = name,
+ skip = skip,
+ since = since,
+ upto = upto,
+ context = context)
+ .futureValue
+
+ result shouldBe JsObject(WhiskActivation.collectionName -> JsNumber(expected))
+ }
+
+ behavior of s"${storeType}ActivationStore listActivationsInNamespace"
+
+ it should "find all entities" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ val activations2 = (1000 until 1100 by 10).map(newActivation(namespace, action2, _))
+ activations2 foreach (store(_, context))
+
+ checkQueryActivations(namespace, context = context, expected = activations ++ activations2)
+ }
+
+ it should "support since and upto filters" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(
+ namespace,
+ since = Some(Instant.ofEpochMilli(1060)),
+ context = context,
+ expected = activations.takeRight(4))
+
+ checkQueryActivations(
+ namespace,
+ upto = Some(Instant.ofEpochMilli(1060)),
+ context = context,
+ expected = activations.take(7))
+
+ checkQueryActivations(
+ namespace,
+ since = Some(Instant.ofEpochMilli(1030)),
+ upto = Some(Instant.ofEpochMilli(1060)),
+ context = context,
+ expected = activations.take(7).takeRight(4))
+ }
+
+ it should "support skipping results" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(namespace, skip = 5, context = context, expected = activations.take(5))
+ }
+
+ it should "support limiting results" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(namespace, limit = 5, context = context, expected = activations.takeRight(5))
+ }
+
+ it should "support including complete docs" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(namespace, includeDocs = true, context = context, expected = activations)
+ }
+
+ it should "throw exception for negative limits and skip" in {
+ implicit val tid: TransactionId = transId()
+
+ a[IllegalArgumentException] should be thrownBy activationStore
+ .listActivationsInNamespace(EntityPath("test"), skip = -1, limit = 10, context = context)
+
+ a[IllegalArgumentException] should be thrownBy activationStore
+ .listActivationsInNamespace(EntityPath("test"), skip = 0, limit = -1, context = context)
+ }
+
+ behavior of s"${storeType}ActivationStore listActivationsMatchingName"
+
+ it should "find all entities matching name" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ val activations2 = (1000 until 1100 by 10).map(newActivation(namespace, action2, _))
+ activations2 foreach (store(_, context))
+
+ checkQueryActivations(namespace, Some(action1), context = context, expected = activations)
+ }
+
+ it should "support since and upto filters" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(
+ namespace,
+ Some(action1),
+ since = Some(Instant.ofEpochMilli(1060)),
+ context = context,
+ expected = activations.takeRight(4))
+
+ checkQueryActivations(
+ namespace,
+ Some(action1),
+ upto = Some(Instant.ofEpochMilli(1060)),
+ context = context,
+ expected = activations.take(7))
+
+ checkQueryActivations(
+ namespace,
+ Some(action1),
+ since = Some(Instant.ofEpochMilli(1030)),
+ upto = Some(Instant.ofEpochMilli(1060)),
+ context = context,
+ expected = activations.take(7).takeRight(4))
+ }
+
+ it should "support skipping results" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(namespace, Some(action1), skip = 5, context = context, expected = activations.take(5))
+ }
+
+ it should "support limiting results" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(namespace, Some(action1), limit = 5, context = context, expected = activations.takeRight(5))
+ }
+
+ it should "support including complete docs" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkQueryActivations(namespace, Some(action1), includeDocs = true, context = context, expected = activations)
+ }
+
+ it should "throw exception for negative limits and skip" in {
+ implicit val tid: TransactionId = transId()
+
+ a[IllegalArgumentException] should be thrownBy activationStore.listActivationsMatchingName(
+ EntityPath("test"),
+ name = EntityPath("testact"),
+ skip = -1,
+ limit = 10,
+ context = context)
+
+ a[IllegalArgumentException] should be thrownBy activationStore.listActivationsMatchingName(
+ EntityPath("test"),
+ name = EntityPath("testact"),
+ skip = 0,
+ limit = -1,
+ context = context)
+ }
+
+ behavior of s"${storeType}ActivationStore countActivationsInNamespace"
+
+ it should "should count all created activations" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkCountActivations(namespace, None, context = context, expected = 10)
+ }
+
+ it should "count with option name" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ val activations2 = (1000 until 1100 by 10).map(newActivation(namespace, action2, _))
+ activations2 foreach (store(_, context))
+
+ checkCountActivations(namespace, Some(EntityPath(action1)), context = context, expected = 10)
+
+ checkCountActivations(namespace, Some(EntityPath(action2)), context = context, expected = 10)
+ }
+
+ it should "count with since and upto" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkCountActivations(namespace, None, since = Some(Instant.ofEpochMilli(1060L)), context = context, expected = 4)
+
+ checkCountActivations(namespace, None, upto = Some(Instant.ofEpochMilli(1060L)), context = context, expected = 7)
+
+ checkCountActivations(
+ namespace,
+ None,
+ since = Some(Instant.ofEpochMilli(1030L)),
+ upto = Some(Instant.ofEpochMilli(1060L)),
+ context = context,
+ expected = 4)
+ }
+
+ it should "count with skip" in {
+ implicit val tid: TransactionId = transId()
+
+ val activations = (1000 until 1100 by 10).map(newActivation(namespace, action1, _))
+ activations foreach (store(_, context))
+
+ checkCountActivations(namespace, None, skip = 4, context = context, expected = 10 - 4)
+ checkCountActivations(namespace, None, skip = 1000, context = context, expected = 0)
+ }
+
+ it should "throw exception for negative skip" in {
+ implicit val tid: TransactionId = transId()
+
+ a[IllegalArgumentException] should be thrownBy activationStore.countActivationsInNamespace(
+ namespace = EntityPath("test"),
+ name = None,
+ skip = -1,
+ context = context)
+ }
+}
----------------------------------------------------------------
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