markusthoemmes closed pull request #3537: Add activation logs integration test
URL: https://github.com/apache/incubator-openwhisk/pull/3537
 
 
   

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/system/basic/WskActivationTests.scala 
b/tests/src/test/scala/system/basic/WskActivationTests.scala
new file mode 100644
index 0000000000..06ce382662
--- /dev/null
+++ b/tests/src/test/scala/system/basic/WskActivationTests.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 system.basic
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+import common.{BaseWsk, JsHelpers, TestHelpers, TestUtils, WskProps, 
WskTestHelpers}
+
+import whisk.utils.retry
+
+import scala.concurrent.duration._
+
+@RunWith(classOf[JUnitRunner])
+abstract class WskActivationTests extends TestHelpers with WskTestHelpers with 
JsHelpers {
+  implicit val wskprops = WskProps()
+
+  val wsk: BaseWsk
+
+  behavior of "Whisk activations"
+
+  it should "fetch logs using activation logs API" in 
withAssetCleaner(wskprops) { (wp, assetHelper) =>
+    val name = "logFetch"
+    val logFormat = "\\d+-\\d+-\\d+T\\d+:\\d+:\\d+.\\d+Z\\s+%s: %s"
+
+    assetHelper.withCleaner(wsk.action, name) { (action, _) =>
+      action.create(name, Some(TestUtils.getTestActionFilename("log.js")))
+    }
+
+    val run = wsk.action.invoke(name, blocking = true)
+
+    // Use withActivation() to reduce intermittent failures that may result 
from eventually consistent DBs
+    withActivation(wsk.activation, run) { activation =>
+      retry({
+        val logs = wsk.activation.logs(Some(activation.activationId)).stdout
+
+        logs should include regex (logFormat.format("stdout", "this is 
stdout"))
+        logs should include regex (logFormat.format("stderr", "this is 
stderr"))
+      }, 10, Some(1.second))
+    }
+  }
+}
diff --git a/tests/src/test/scala/system/basic/WskRestActivationTests.scala 
b/tests/src/test/scala/system/basic/WskRestActivationTests.scala
new file mode 100644
index 0000000000..50449383ab
--- /dev/null
+++ b/tests/src/test/scala/system/basic/WskRestActivationTests.scala
@@ -0,0 +1,28 @@
+/*
+ * 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 system.basic
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+import common.rest.WskRest
+
+@RunWith(classOf[JUnitRunner])
+class WskRestActivationTests extends WskActivationTests {
+  override val wsk: WskRest = new WskRest
+}


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to