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/02/06 13:51:35 UTC

[GitHub] dubeejw closed pull request #3170: Add controller info route test

dubeejw closed pull request #3170: Add controller info route test
URL: https://github.com/apache/incubator-openwhisk/pull/3170
 
 
   

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/controller/test/ControllerApiTests.scala b/tests/src/test/scala/whisk/core/controller/test/ControllerApiTests.scala
new file mode 100644
index 0000000000..6aea3caf83
--- /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)
+  }
+
+}


 

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