You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/08/07 18:19:23 UTC

[GitHub] dubeejw commented on a change in pull request #2490: CLI summaries for actions without annotations

dubeejw commented on a change in pull request #2490: CLI summaries for actions without annotations
URL: https://github.com/apache/incubator-openwhisk/pull/2490#discussion_r131725811
 
 

 ##########
 File path: tests/src/test/scala/system/basic/WskBasicTests.scala
 ##########
 @@ -410,6 +487,98 @@ class WskBasicTests
             stdout should include regex (s"(?i)action /$ns/$name: Action description\\s*\\(parameters: paramName1, paramName2\\)")
     }
 
+    it should "create, and get an action summary without a description and/or defined parameters" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val actNameNoParams = "actionNoParams"
+            val actNameNoDesc = "actionNoDesc"
+            val actNameNoDescOrParams = "actionNoDescOrParams"
+            val desc = "Action description"
+            val descFromParamsResp = "Returns a result based on parameters"
+            val annotsNoParams = Map(
+                "description" -> JsString(desc)
+            )
+            val annotsNoDesc = Map(
+                "parameters" -> JsArray(
+                    JsObject(
+                        "name" -> JsString("paramName1"),
+                        "description" -> JsString("Parameter description 1")),
+                    JsObject(
+                        "name" -> JsString("paramName2"),
+                        "description" -> JsString("Parameter description 2"))))
+
+            assetHelper.withCleaner(wsk.action, actNameNoDesc) {
+                (action, _) =>
+                    action.create(actNameNoDesc, defaultAction, annotations = annotsNoDesc)
+            }
+            assetHelper.withCleaner(wsk.action, actNameNoParams) {
+                (action, _) =>
+                    action.create(actNameNoParams, defaultAction, annotations = annotsNoParams)
+            }
+            assetHelper.withCleaner(wsk.action, actNameNoDescOrParams) {
+                (action, _) =>
+                    action.create(actNameNoDescOrParams, defaultAction)
+            }
+
+            val stdoutNoDesc = wsk.action.get(actNameNoDesc, summary = true).stdout
+            val stdoutNoParams = wsk.action.get(actNameNoParams, summary = true).stdout
+            val stdoutNoDescOrParams = wsk.action.get(actNameNoDescOrParams, summary = true).stdout
+            val ns_regex_list = wsk.namespace.list().stdout.trim.replace('\n', '|')
+
+            stdoutNoDesc should include regex (
+                s"(?i)action /${ns_regex_list}/${actNameNoDesc}: ${descFromParamsResp} paramName1 and paramName2\\s*\\(parameters: paramName1, paramName2\\)")
+            stdoutNoParams should include regex (
+                s"(?i)action /${ns_regex_list}/${actNameNoParams}: ${desc}\\s*\\(parameters: none defined\\)")
+            stdoutNoDescOrParams should include regex (
+                s"(?i)action /${ns_regex_list}/${actNameNoDescOrParams}\\s*\\(parameters: none defined\\)")
+    }
+
+    it should "denote bound and finalized action parameters for action summaries" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val nameBoundParams = "actionBoundParams"
+            val nameFinalParams = "actionFinalParams"
+            val paramAnnot = "paramAnnot"
+            val paramOverlap = "paramOverlap"
+            val paramBound = "paramBound"
+            val annots = Map(
+                "parameters" -> JsArray(
+                    JsObject(
+                        "name" -> JsString(paramAnnot),
+                        "description" -> JsString("Annotated")),
+                    JsObject(
+                        "name" -> JsString(paramOverlap),
+                        "description" -> JsString("Annotated And Bound"))))
+            val annotsFinal = Map(
+                "final" -> JsBoolean(true),
+                "parameters" -> JsArray(
+                    JsObject(
+                        "name" -> JsString(paramAnnot),
+                        "description" -> JsString("Annotated Parameter description")),
+                    JsObject(
+                        "name" -> JsString(paramOverlap),
+                        "description" -> JsString("Annotated And Bound"))))
+            val paramsBound = Map(
+                paramBound -> JsString("Bound"),
+                paramOverlap -> JsString("Bound And Annotated"))
+
+            assetHelper.withCleaner(wsk.action, nameBoundParams) {
+                (action, _) =>
+                    action.create(nameBoundParams, defaultAction, annotations = annots, parameters = paramsBound)
+            }
+            assetHelper.withCleaner(wsk.action, nameFinalParams) {
+                (action, _) =>
+                    action.create(nameFinalParams, defaultAction, annotations = annotsFinal, parameters = paramsBound)
+            }
+
+            val stdoutBound = wsk.action.get(nameBoundParams, summary = true).stdout
+            val stdoutFinal = wsk.action.get(nameFinalParams, summary = true).stdout
+            val ns_regex_list = wsk.namespace.list().stdout.trim.replace('\n', '|')
 
 Review comment:
   `ns_regex_list` is not used.
 
----------------------------------------------------------------
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