You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/07/18 20:57:14 UTC

[incubator-openwhisk-cli] branch master updated: Sync tests + cli (#87)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new 15e18d4  Sync tests + cli (#87)
15e18d4 is described below

commit 15e18d4a12eaed239f43440a33b33210fb6f0dcb
Author: Vincent <sh...@us.ibm.com>
AuthorDate: Tue Jul 18 16:57:12 2017 -0400

    Sync tests + cli (#87)
    
    * Remove Unsupported Shared Flag from Package List (Review) (#2495)
    
    * Externalize SetDefaultProperties (#2499)
    
    * Harden system tests for --last flag. (#2497)
    
    Using a hardcoded Thread.sleep timeout will inevitably fail in different test environments. Using the test helpers that retry under the hood will make those tests less intermittent failure prone.
    
    The rejection test doesn't actually need to invoke an action.
---
 commands/package.go                                | 10 +-------
 commands/property.go                               |  4 +--
 .../test/scala/system/basic/WskBasicTests.scala    | 30 ++++++++++------------
 tools/travis/test_openwhisk.sh                     |  8 +++---
 4 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/commands/package.go b/commands/package.go
index 68e75c5..89b882f 100644
--- a/commands/package.go
+++ b/commands/package.go
@@ -378,7 +378,6 @@ var packageListCmd = &cobra.Command{
   PreRunE:       setupClientConfig,
   RunE: func(cmd *cobra.Command, args []string) error {
     var err error
-    var shared bool
     var qualifiedName QualifiedName
 
     if whiskErr := checkArgs(args, 0, 1, "Package list",
@@ -398,16 +397,9 @@ var packageListCmd = &cobra.Command{
       client.Namespace = qualifiedName.namespace
     }
 
-    if Flags.common.shared == "yes" {
-      shared = true
-    } else {
-      shared = false
-    }
-
     options := &whisk.PackageListOptions{
       Skip:   Flags.common.skip,
       Limit:  Flags.common.limit,
-      Public: shared,
     }
 
     packages, _, err := client.Packages.List(options)
@@ -420,6 +412,7 @@ var packageListCmd = &cobra.Command{
     }
 
     printList(packages)
+
     return nil
   },
 }
@@ -528,7 +521,6 @@ func init() {
   packageBindCmd.Flags().StringSliceVarP(&Flags.common.param, "param", "p", []string{}, wski18n.T("parameter values in `KEY VALUE` format"))
   packageBindCmd.Flags().StringVarP(&Flags.common.paramFile, "param-file", "P", "", wski18n.T("`FILE` containing parameter values in JSON format"))
 
-  packageListCmd.Flags().StringVar(&Flags.common.shared, "shared", "", wski18n.T("include publicly shared entities in the result"))
   packageListCmd.Flags().IntVarP(&Flags.common.skip, "skip", "s", 0, wski18n.T("exclude the first `SKIP` number of packages from the result"))
   packageListCmd.Flags().IntVarP(&Flags.common.limit, "limit", "l", 30, wski18n.T("only return `LIMIT` number of packages from the collection"))
 
diff --git a/commands/property.go b/commands/property.go
index a29ab14..8e81390 100644
--- a/commands/property.go
+++ b/commands/property.go
@@ -338,7 +338,7 @@ func init() {
 
 }
 
-func setDefaultProperties() {
+func SetDefaultProperties() {
     Properties.Auth = DefaultAuth
     Properties.Namespace = DefaultNamespace
     Properties.APIHost = DefaultAPIHost
@@ -379,7 +379,7 @@ func GetPropertiesFilePath() (propsFilePath string, werr error) {
 func loadProperties() error {
     var err error
 
-    setDefaultProperties()
+    SetDefaultProperties()
 
     Properties.PropsFile, err = GetPropertiesFilePath()
     if err != nil {
diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskBasicTests.scala
index ef86c1b..ed926a2 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -864,19 +864,19 @@ class WskBasicTests
                 (action, _) => wsk.action.create("lastName", defaultAction)
             }
             val lastInvoke = wsk.action.invoke("lastName")
-            val includeID = wsk.activation.extractActivationId(lastInvoke).get
-            Thread.sleep(1000)
-
-            val lastFlag = Seq(
-                (Seq("activation", "get", "publish", "--last"), includeID),
-                (Seq("activation", "get", "--last"), includeID),
-                (Seq("activation", "logs", "--last"), includeStr),
-                (Seq("activation", "result", "--last"), includeStr))
+            withActivation(wsk.activation, lastInvoke) {
+                activation =>
+                    val lastFlag = Seq(
+                        (Seq("activation", "get", "publish", "--last"), activation.activationId),
+                        (Seq("activation", "get", "--last"), activation.activationId),
+                        (Seq("activation", "logs", "--last"), includeStr),
+                        (Seq("activation", "result", "--last"), includeStr))
 
-            lastFlag foreach {
-                case (cmd, output) =>
-                    val stdout = wsk.cli(cmd ++ wskprops.overrides ++ auth, expectedExitCode = SUCCESS_EXIT).stdout
-                    stdout should include(output)
+                    lastFlag foreach {
+                        case (cmd, output) =>
+                            val stdout = wsk.cli(cmd ++ wskprops.overrides ++ auth, expectedExitCode = SUCCESS_EXIT).stdout
+                            stdout should include(output)
+                    }
             }
     }
 
@@ -884,13 +884,9 @@ class WskBasicTests
         (wp, assetHelper) =>
             val auth: Seq[String] = Seq("--auth", wskprops.authKey)
 
-            assetHelper.withCleaner(wsk.action, "lastName") {
-                (action, _) => wsk.action.create("lastName", defaultAction)
-            }
-            val lastId = wsk.activation.extractActivationId(wsk.action.invoke("lastName")).get
+            val lastId = "dummyActivationId"
             val tooManyArgsMsg = s"${lastId}. An activation ID is required."
             val invalidField = s"Invalid field filter '${lastId}'."
-            Thread.sleep(1000)
 
             val invalidCmd = Seq(
                 (Seq("activation", "get", s"$lastId", "publish", "--last"), tooManyArgsMsg),
diff --git a/tools/travis/test_openwhisk.sh b/tools/travis/test_openwhisk.sh
index 5268500..29ac6bc 100755
--- a/tools/travis/test_openwhisk.sh
+++ b/tools/travis/test_openwhisk.sh
@@ -38,11 +38,13 @@ cp $TRAVIS_BUILD_DIR/wsk $WHISKDIR/bin
 
 # Run the test cases under openwhisk to ensure the quality of the binary.
 cd $TRAVIS_BUILD_DIR
-./gradlew :tests:test -Dtest.single=Wsk*Tests*
-./gradlew :tests:test -Dtest.single=*ApiGwRoutemgmtActionTests*
-sleep 30
+
 ./gradlew :tests:test -Dtest.single=*ApiGwTests*
 sleep 30
+./gradlew :tests:test -Dtest.single=*ApiGwRoutemgmtActionTests*
+sleep 30
 ./gradlew :tests:test -Dtest.single=*ApiGwEndToEndTests*
 sleep 30
+./gradlew :tests:test -Dtest.single=Wsk*Tests*
+
 make integration_test

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].