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 2019/02/12 10:17:53 UTC

[GitHub] chetanmeh commented on a change in pull request #4031: Add common test codes for ActivationStore

chetanmeh commented on a change in pull request #4031: Add common test codes for ActivationStore
URL: https://github.com/apache/incubator-openwhisk/pull/4031#discussion_r255882825
 
 

 ##########
 File path: 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)
 
 Review comment:
   Note that the `namespace` and `action` would remain same for all test. Though we do a cleanup after each run it may be better to use different name for each test run

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