rabbah commented on a change in pull request #2326: Alphabetize listings in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2326#discussion_r132605989
 
 

 ##########
 File path: tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
 ##########
 @@ -959,6 +959,141 @@ class WskBasicUsageTests
             }, 5, Some(1 second))
     }
 
+    it should "return a list of alphabetized actions" in 
withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            // Declare 4 actions, create them out of alphabetical order
+            val actionName = "actionAlphaTest"
+            for (i <- 1 to 3) {
+                val name = s"$actionName$i"
+                assetHelper.withCleaner(wsk.action, name) {
+                    (action, name) =>
+                        action.create(name, defaultAction)
+                }
+            }
+            retry({
+                val original = wsk.action.list(nameSort = Some(true)).stdout
+                // Create list with action names in correct order
+                val scalaSorted = List(s"${actionName}1", s"${actionName}2", 
s"${actionName}3")
+                // Filter out everything not previously created
+                val regex = s"${actionName}[1-3]".r
+                // Retrieve action names into list as found in original
+                val list  = (regex.findAllMatchIn(original)).toList
+                scalaSorted.toString shouldEqual list.toString
 
 Review comment:
   i'm guessing `.toString` here isn't necessary.
   
   is it?
   applies in multiple places.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to