markusthoemmes commented on a change in pull request #3619: Provide an
activation store SPI
URL:
https://github.com/apache/incubator-openwhisk/pull/3619#discussion_r191153047
##########
File path:
tests/src/test/scala/whisk/core/controller/test/ActivationsApiTests.scala
##########
@@ -92,43 +92,58 @@ class ActivationsApiTests extends ControllerTestCommon
with WhiskActivationsApi
start = Instant.now,
end = Instant.now)
}.toList
- activations foreach { put(activationStore, _) }
- waitOnView(activationStore, namespace.root, 2, WhiskActivation.view)
- whisk.utils.retry {
- Get(s"$collectionPath") ~> Route.seal(routes(creds)) ~> check {
- status should be(OK)
- val response = responseAs[List[JsObject]]
- activations.length should be(response.length)
- response should contain theSameElementsAs
activations.map(_.summaryAsJson)
- response forall { a =>
- a.getFields("for") match {
- case Seq(JsString(n)) => n == actionName.asString
- case _ => false
+ try {
+ notExpectedActivations foreach {
+ storeActivation(_)
+ }
+ activations foreach {
+ storeActivation(_)
+ }
+ waitOnListActivationsInNamespace(namespace, 2)
+ whisk.utils.retry {
+ Get(s"$collectionPath") ~> Route.seal(routes(creds)) ~> check {
+ status should be(OK)
+ val response = responseAs[List[JsObject]]
+ activations.length should be(response.length)
+ response should contain theSameElementsAs
activations.map(_.summaryAsJson)
+ response forall { a =>
+ a.getFields("for") match {
+ case Seq(JsString(n)) => n == actionName.asString
+ case _ => false
+ }
}
}
}
- }
- // it should "list activations with explicit namespace owned by subject"
in {
- whisk.utils.retry {
- Get(s"/$namespace/${collection.path}") ~> Route.seal(routes(creds)) ~>
check {
- status should be(OK)
- val response = responseAs[List[JsObject]]
- activations.length should be(response.length)
- response should contain theSameElementsAs
activations.map(_.summaryAsJson)
- response forall { a =>
- a.getFields("for") match {
- case Seq(JsString(n)) => n == actionName.asString
- case _ => false
+ // it should "list activations with explicit namespace owned by subject"
in {
+ whisk.utils.retry {
+ Get(s"/$namespace/${collection.path}") ~> Route.seal(routes(creds)) ~>
check {
+ status should be(OK)
+ val response = responseAs[List[JsObject]]
+ activations.length should be(response.length)
+ response should contain theSameElementsAs
activations.map(_.summaryAsJson)
+ response forall { a =>
+ a.getFields("for") match {
+ case Seq(JsString(n)) => n == actionName.asString
+ case _ => false
+ }
}
}
}
- }
- // it should "reject list activations with explicit namespace not owned by
subject" in {
- val auser = WhiskAuthHelpers.newIdentity()
- Get(s"/$namespace/${collection.path}") ~> Route.seal(routes(auser)) ~>
check {
- status should be(Forbidden)
+ // it should "reject list activations with explicit namespace not owned
by subject" in {
+ val auser = WhiskAuthHelpers.newIdentity()
+ Get(s"/$namespace/${collection.path}") ~> Route.seal(routes(auser)) ~>
check {
+ status should be(Forbidden)
+ }
+
+ } finally {
+ notExpectedActivations foreach { activation =>
+ deleteActivation(ActivationId(activation.docid.asString))
+ }
+ activations foreach { activation =>
+ deleteActivation(ActivationId(activation.docid.asString))
+ }
Review comment:
Can likewise be shorthanded
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services