dubeejw commented on a change in pull request #3170: Add controller info route 
test
URL: 
https://github.com/apache/incubator-openwhisk/pull/3170#discussion_r160740263
 
 

 ##########
 File path: tests/src/test/scala/system/rest/ControllerTests.scala
 ##########
 @@ -0,0 +1,63 @@
+/*
+ * 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.rest
+
+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.entity.test.ExecHelpers
+import whisk.core.WhiskConfig
+
+/**
+ * Integration tests for Controller routes
+ */
+@RunWith(classOf[JUnitRunner])
+class ControllerTests 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 runtimes = getRuntimesManifest
+    val config = new WhiskConfig(
+      Map(
+        WhiskConfig.actionInvokePerMinuteLimit -> null,
+        WhiskConfig.triggerFirePerMinuteLimit -> null,
+        WhiskConfig.actionInvokeConcurrentLimit -> null))
+    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" -> runtimes.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)
+  }
+}
 
 Review comment:
   We want to ensure that nginx routes us to the proper location, so a unit 
test wouldn't suffice. 

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

Reply via email to