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/29 18:16:00 UTC

[GitHub] rabbah commented on a change in pull request #2544: Allow CLI to Save Code from Action (Review)

rabbah commented on a change in pull request #2544: Allow CLI to Save Code from Action (Review)
URL: https://github.com/apache/incubator-openwhisk/pull/2544#discussion_r135870714
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##########
 @@ -826,6 +828,72 @@ class WskBasicUsageTests
                 s"(?i)action /${namespace}/${actNameNoDescOrParams}\\s*\\(parameters: none defined\\)")
     }
 
+    it should "save action code to file" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val name = "saveAction"
+            val seqName = "seqName"
+            val dockerName = "dockerName"
+            val containerName = s"bogus${Random.alphanumeric.take(16).mkString.toLowerCase}"
+            val saveName = s"save-as-$name.js"
+            val currentDir = System.getProperty("user.dir")
+            val saveDir = if (currentDir.endsWith("tests")) {
+                currentDir
+            } else {
+                s"$currentDir${File.separator}tests"
+            }
+            val badSaveName = s"bad-directory${File.separator}$saveName"
+
+            assetHelper.withCleaner(wsk.action, name) {
+                (action, _) =>
+                    action.create(name, defaultAction)
+            }
+
+            wsk.action.get(name, save = Some(true)).stdout should include(s"saved action code to $name.js")
 
 Review comment:
   i see the difference --- i think for simplicity, i'd prefer one option.
   is this cobra getting in the way again because you can't have a default argument?
   
   ie `--save` saves to inferred name and `--save file.name` to save to explicit file.
 
----------------------------------------------------------------
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