You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by du...@apache.org on 2018/02/06 13:51:34 UTC

[incubator-openwhisk] branch master updated: Add controller info route test (#3170)

This is an automated email from the ASF dual-hosted git repository.

dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new a6b3faf  Add controller info route test (#3170)
a6b3faf is described below

commit a6b3faf21101fe2b229d243cd23c9517a4593687
Author: James Dubee <jw...@us.ibm.com>
AuthorDate: Tue Feb 6 08:51:31 2018 -0500

    Add controller info route test (#3170)
    
    * Add controller info route test
---
 .../core/controller/test/ControllerApiTests.scala  | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/tests/src/test/scala/whisk/core/controller/test/ControllerApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/ControllerApiTests.scala
new file mode 100644
index 0000000..6aea3ca
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/controller/test/ControllerApiTests.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.controller.test
+
+import org.junit.runner.RunWith
+import org.scalatest.FlatSpec
+import org.scalatest.Matchers
+import org.scalatest.junit.JUnitRunner
+
+import com.jayway.restassured.RestAssured
+
+import common.StreamLogging
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+
+import whisk.core.WhiskConfig
+import whisk.core.entity.ExecManifest
+
+import system.rest.RestUtil
+
+/**
+ * Integration tests for Controller routes
+ */
+@RunWith(classOf[JUnitRunner])
+class ControllerApiTests extends FlatSpec with RestUtil with Matchers /*with ExecHelpers*/ with StreamLogging {
+
+  it should "ensure controller returns info" in {
+    val response = RestAssured.given.config(sslconfig).get(getServiceURL)
+    val config = new WhiskConfig(
+      Map(
+        WhiskConfig.actionInvokePerMinuteLimit -> null,
+        WhiskConfig.triggerFirePerMinuteLimit -> null,
+        WhiskConfig.actionInvokeConcurrentLimit -> null,
+        WhiskConfig.runtimesManifest -> null))
+    ExecManifest.initialize(config) should be a 'success
+    val expectedJson = JsObject(
+      "support" -> JsObject(
+        "github" -> "https://github.com/apache/incubator-openwhisk/issues".toJson,
+        "slack" -> "http://slack.openwhisk.org".toJson),
+      "description" -> "OpenWhisk".toJson,
+      "api_paths" -> JsArray("/api/v1".toJson),
+      "runtimes" -> ExecManifest.runtimesManifest.toJson,
+      "limits" -> JsObject(
+        "actions_per_minute" -> config.actionInvokePerMinuteLimit.toInt.toJson,
+        "triggers_per_minute" -> config.triggerFirePerMinuteLimit.toInt.toJson,
+        "concurrent_actions" -> config.actionInvokeConcurrentLimit.toInt.toJson))
+    response.statusCode should be(200)
+    response.body.asString.parseJson shouldBe (expectedJson)
+  }
+
+}

-- 
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.