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/08/01 22:12:02 UTC

[incubator-openwhisk-cli] 03/06: Move CLI Config Tests into Separate Suite (#2534)

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

commit 1b8c7d9930fec99ad2aac6aa6b31e9d867366deb
Author: James Dubee <jw...@us.ibm.com>
AuthorDate: Thu Jul 27 10:10:18 2017 -0400

    Move CLI Config Tests into Separate Suite (#2534)
---
 .../test/scala/system/basic/WskBasicTests.scala    |  16 --
 .../whisk/core/cli/test/WskBasicUsageTests.scala   | 205 +---------------
 .../scala/whisk/core/cli/test/WskConfigTests.scala | 261 +++++++++++++++++++++
 3 files changed, 262 insertions(+), 220 deletions(-)

diff --git a/tests/src/test/scala/system/basic/WskBasicTests.scala b/tests/src/test/scala/system/basic/WskBasicTests.scala
index b82dd2d..be17527 100644
--- a/tests/src/test/scala/system/basic/WskBasicTests.scala
+++ b/tests/src/test/scala/system/basic/WskBasicTests.scala
@@ -17,7 +17,6 @@
 
 package system.basic
 
-import java.io.File
 import java.time.Instant
 
 import scala.concurrent.duration.DurationInt
@@ -51,21 +50,6 @@ class WskBasicTests
         Wsk.exists
     }
 
-    it should "show api build details" in {
-        val tmpProps = File.createTempFile("wskprops", ".tmp")
-        try {
-            val env = Map("WSK_CONFIG_FILE" -> tmpProps.getAbsolutePath())
-            wsk.cli(Seq("property", "set", "-i") ++ wskprops.overrides, env = env)
-            val rr = wsk.cli(Seq("property", "get", "--apibuild", "--apibuildno", "-i"), env = env)
-            rr.stderr should not include ("https:///api/v1: http: no Host in request URL")
-            rr.stdout should not include regex("Cannot determine API build")
-            rr.stdout should include regex ("""(?i)whisk API build\s+201.*""")
-            rr.stdout should include regex ("""(?i)whisk API build number\s+.*""")
-        } finally {
-            tmpProps.delete()
-        }
-    }
-
     it should "reject creating duplicate entity" in withAssetCleaner(wskprops) {
         (wp, assetHelper) =>
             val name = "testDuplicateCreate"
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
index ad8de5d..e0dd977 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -30,7 +30,6 @@ import scala.concurrent.duration.Duration
 import scala.concurrent.duration.DurationInt
 import scala.util.Random
 
-import org.apache.commons.io.FileUtils
 import org.junit.runner.RunWith
 import org.scalatest.junit.JUnitRunner
 
@@ -72,7 +71,7 @@ class WskBasicUsageTests
     }
 
     it should "show help and usage info" in {
-        val stdout = wsk.cli(Seq("-h")).stdout
+        val stdout = wsk.cli(Seq()).stdout
         stdout should include regex ("""(?i)Usage:""")
         stdout should include regex ("""(?i)Flags""")
         stdout should include regex ("""(?i)Available commands""")
@@ -95,200 +94,11 @@ class WskBasicUsageTests
         stdout should include regex ("""(?i)whisk API version\s+v1""")
     }
 
-    it should "set apihost, auth, and namespace" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        try {
-            val namespace = wsk.namespace.whois()
-            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-            val stdout = wsk.cli(Seq("property", "set", "-i",
-                "--apihost", wskprops.apihost,
-                "--auth", wskprops.authKey,
-                "--namespace", namespace),
-                env = env).stdout
-            stdout should include(s"ok: whisk auth set")
-            stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
-            stdout should include(s"ok: whisk namespace set to ${namespace}")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    // If client certificate verification is off, should ingore run below tests.
-    if (!WhiskProperties.getProperty("whisk.ssl.client.verification").equals("off")) {
-        it should "set valid cert key to get expected success result for client certificate verification" in {
-            val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-            try {
-                val namespace = wsk.namespace.list().stdout.trim.split("\n").last
-                val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-                // Send request to https://<apihost>/api/v1/namespaces, wsk client passes client certificate to nginx, nginx will
-                // verify it by client ca's openwhisk-client-ca-cert.pem
-                val stdout = wsk.cli(Seq("property", "set", "-i", "--apihost", wskprops.apihost, "--auth", wskprops.authKey,
-                    "--cert", wskprops.cert, "--key", wskprops.key, "--namespace", namespace), env = env).stdout
-                stdout should include(s"ok: client cert set")
-                stdout should include(s"ok: client key set")
-                stdout should include(s"ok: whisk auth set")
-                stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
-                stdout should include(s"ok: whisk namespace set to ${namespace}")
-            } finally {
-                tmpwskprops.delete()
-            }
-        }
-
-        it should "set invalid cert key to get expected exception result for client certificate verification" in {
-            val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-            try {
-                val namespace = wsk.namespace.list().stdout.trim.split("\n").last
-                val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-                val thrown = the[Exception] thrownBy wsk.cli(Seq("property", "set", "-i", "--apihost", wskprops.apihost, "--auth", wskprops.authKey,
-                    "--cert", "invalid-cert.pem", "--key", "invalid-key.pem", "--namespace", namespace), env = env)
-                thrown.getMessage should include("cannot validate certificate")
-            } finally {
-                tmpwskprops.delete()
-            }
-        }
-    }
-
-    it should "ensure default namespace is used when a blank namespace is set" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        try {
-            val writer = new BufferedWriter(new FileWriter(tmpwskprops))
-            writer.write(s"NAMESPACE=")
-            writer.close()
-            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-            val stdout = wsk.cli(Seq("property", "get", "-i", "--namespace"), env = env).stdout
-            stdout should include regex ("whisk namespace\\s+_")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "show api build version using property file" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        try {
-            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-            wsk.cli(Seq("property", "set", "-i") ++ wskprops.overrides, env = env)
-            val stdout = wsk.cli(Seq("property", "get", "--apibuild", "-i"), env = env).stdout
-            stdout should include regex ("""(?i)whisk API build\s+201.*""")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "fail to show api build when setting apihost to bogus value" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        try {
-            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-            wsk.cli(Seq("property", "set", "-i", "--apihost", "xxxx.yyyy"), env = env)
-            val rr = wsk.cli(Seq("property", "get", "--apibuild", "-i"), env = env, expectedExitCode = ANY_ERROR_EXIT)
-            rr.stdout should include regex ("""whisk API build\s*Unknown""")
-            rr.stderr should include regex ("Unable to obtain API build information")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "show api build using http apihost" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        try {
-            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-            val apihost = s"http://${WhiskProperties.getBaseControllerAddress()}"
-            wsk.cli(Seq("property", "set", "--apihost", apihost), env = env)
-            val rr = wsk.cli(Seq("property", "get", "--apibuild", "-i"), env = env)
-            rr.stdout should not include regex("""whisk API build\s*Unknown""")
-            rr.stderr should not include regex("Unable to obtain API build information")
-            rr.stdout should include regex ("""(?i)whisk API build\s+201.*""")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "validate default property values" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-        val stdout = wsk.cli(Seq("property", "unset", "--auth", "--cert", "--key", "--apihost", "--apiversion", "--namespace"), env = env).stdout
-        try {
-            stdout should include regex ("ok: whisk auth unset")
-            stdout should include regex ("ok: client cert unset")
-            stdout should include regex ("ok: client key unset")
-            stdout should include regex ("ok: whisk API host unset")
-            stdout should include regex ("ok: whisk API version unset")
-            stdout should include regex ("ok: whisk namespace unset")
-
-            wsk.cli(Seq("property", "get", "--auth"), env = env).
-                stdout should include regex ("""(?i)whisk auth\s*$""") // default = empty string
-            wsk.cli(Seq("property", "get", "--cert"), env = env).
-                stdout should include regex ("""(?i)client cert\s*$""") // default = empty string
-            wsk.cli(Seq("property", "get", "--key"), env = env).
-                stdout should include regex ("""(?i)client key\s*$""") // default = empty string
-            wsk.cli(Seq("property", "get", "--apihost"), env = env).
-                stdout should include regex ("""(?i)whisk API host\s*$""") // default = empty string
-            wsk.cli(Seq("property", "get", "--namespace"), env = env).
-                stdout should include regex ("""(?i)whisk namespace\s*_$""") // default = _
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "set auth in property file" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-        wsk.cli(Seq("property", "set", "--auth", "testKey"), env = env)
-        try {
-            val fileContent = FileUtils.readFileToString(tmpwskprops)
-            fileContent should include("AUTH=testKey")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "set multiple property values with single command" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-        val stdout = wsk.cli(Seq("property", "set", "--auth", "testKey", "--cert", "cert.pem", "--key", "key.pem", "--apihost", "openwhisk.ng.bluemix.net", "--apiversion", "v1"), env = env).stdout
-        try {
-            stdout should include regex ("ok: whisk auth set")
-            stdout should include regex ("ok: client cert set")
-            stdout should include regex ("ok: client key set")
-            stdout should include regex ("ok: whisk API host set")
-            stdout should include regex ("ok: whisk API version set")
-            val fileContent = FileUtils.readFileToString(tmpwskprops)
-            fileContent should include("AUTH=testKey")
-            fileContent should include("APIHOST=openwhisk.ng.bluemix.net")
-            fileContent should include("APIVERSION=v1")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
     it should "reject bad command" in {
         val result = wsk.cli(Seq("bogus"), expectedExitCode = ERROR_EXIT)
         result.stderr should include regex ("""(?i)Run 'wsk --help' for usage""")
     }
 
-    it should "reject authenticated command when no auth key is given" in {
-        // override wsk props file in case it exists
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-        val stderr = wsk.cli(Seq("list") ++ wskprops.overrides, env = env, expectedExitCode = MISUSE_EXIT).stderr
-        try {
-            stderr should include regex (s"usage[:.]") // Python CLI: "usage:", Go CLI: "usage."
-            stderr should include("--auth is required")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
-    it should "reject a command when the API host is not set" in {
-        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
-        try {
-            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
-            val stderr = wsk.cli(Seq("property", "get", "-i"), env = env, expectedExitCode = ERROR_EXIT).stderr
-            stderr should include("The API host is not valid: An API host must be provided.")
-        } finally {
-            tmpwskprops.delete()
-        }
-    }
-
     behavior of "Wsk actions"
 
     it should "reject creating entities with invalid names" in withAssetCleaner(wskprops) {
@@ -1509,17 +1319,4 @@ class WskBasicUsageTests
             testLimit(None, Some(32768.MB), None, BAD_REQUEST)
             testLimit(None, None, Some(32768.MB), BAD_REQUEST)
     }
-
-    it should "create a trigger using property file" in withAssetCleaner(wskprops) {
-        (wp, assetHelper) =>
-            val name = "listTriggers"
-            val tmpProps = File.createTempFile("wskprops", ".tmp")
-            val env = Map("WSK_CONFIG_FILE" -> tmpProps.getAbsolutePath())
-            wsk.cli(Seq("property", "set", "--auth", wp.authKey) ++ wskprops.overrides, env = env)
-            assetHelper.withCleaner(wsk.trigger, name) {
-                (trigger, _) =>
-                    wsk.cli(Seq("-i", "trigger", "create", name), env = env)
-            }
-            tmpProps.delete()
-    }
 }
diff --git a/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
new file mode 100644
index 0000000..fbe1631
--- /dev/null
+++ b/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
@@ -0,0 +1,261 @@
+/*
+ * 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 whisk.core.cli.test
+
+import java.io.File
+import java.io.BufferedWriter
+import java.io.FileWriter
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+import org.apache.commons.io.FileUtils
+
+import common.WhiskProperties
+import common.TestHelpers
+import common.TestUtils._
+import common.Wsk
+import common.WskProps
+import common.WskTestHelpers
+
+@RunWith(classOf[JUnitRunner])
+class WskConfigTests
+    extends TestHelpers
+    with WskTestHelpers {
+
+    implicit val wskprops = WskProps()
+    val wsk = new Wsk
+
+    behavior of "Wsk CLI config"
+
+    it should "fail to show api build when setting apihost to bogus value" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        try {
+            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+            wsk.cli(Seq("property", "set", "-i", "--apihost", "xxxx.yyyy"), env = env)
+            val rr = wsk.cli(Seq("property", "get", "--apibuild", "-i"), env = env, expectedExitCode = ANY_ERROR_EXIT)
+            rr.stdout should include regex ("""whisk API build\s*Unknown""")
+            rr.stderr should include regex ("Unable to obtain API build information")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "validate default property values" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+        val stdout = wsk.cli(Seq("property", "unset", "--auth", "--cert", "--key", "--apihost", "--apiversion", "--namespace"), env = env).stdout
+        try {
+            stdout should include regex ("ok: whisk auth unset")
+            stdout should include regex ("ok: client cert unset")
+            stdout should include regex ("ok: client key unset")
+            stdout should include regex ("ok: whisk API host unset")
+            stdout should include regex ("ok: whisk API version unset")
+            stdout should include regex ("ok: whisk namespace unset")
+
+            wsk.cli(Seq("property", "get", "--auth"), env = env).
+                    stdout should include regex ("""(?i)whisk auth\s*$""") // default = empty string
+            wsk.cli(Seq("property", "get", "--cert"), env = env).
+                    stdout should include regex ("""(?i)client cert\s*$""") // default = empty string
+            wsk.cli(Seq("property", "get", "--key"), env = env).
+                    stdout should include regex ("""(?i)client key\s*$""") // default = empty string
+            wsk.cli(Seq("property", "get", "--apihost"), env = env).
+                    stdout should include regex ("""(?i)whisk API host\s*$""") // default = empty string
+            wsk.cli(Seq("property", "get", "--namespace"), env = env).
+                    stdout should include regex ("""(?i)whisk namespace\s*_$""") // default = _
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "reject authenticated command when no auth key is given" in {
+        // override wsk props file in case it exists
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+        val stderr = wsk.cli(Seq("list") ++ wskprops.overrides, env = env, expectedExitCode = MISUSE_EXIT).stderr
+        try {
+            stderr should include regex (s"usage[:.]")
+            stderr should include("--auth is required")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "reject a command when the API host is not set" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        try {
+            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+            val stderr = wsk.cli(Seq("property", "get", "-i"), env = env, expectedExitCode = ERROR_EXIT).stderr
+            stderr should include("The API host is not valid: An API host must be provided.")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "show api build details" in {
+        val tmpProps = File.createTempFile("wskprops", ".tmp")
+        try {
+            val env = Map("WSK_CONFIG_FILE" -> tmpProps.getAbsolutePath())
+            wsk.cli(Seq("property", "set", "-i") ++ wskprops.overrides, env = env)
+            val rr = wsk.cli(Seq("property", "get", "--apibuild", "--apibuildno", "-i"), env = env)
+            rr.stderr should not include ("https:///api/v1: http: no Host in request URL")
+            rr.stdout should not include regex("Cannot determine API build")
+            rr.stdout should include regex ("""(?i)whisk API build\s+201.*""")
+            rr.stdout should include regex ("""(?i)whisk API build number\s+.*""")
+        } finally {
+            tmpProps.delete()
+        }
+    }
+
+    it should "set apihost, auth, and namespace" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        try {
+            val namespace = wsk.namespace.whois()
+            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+            val stdout = wsk.cli(Seq("property", "set", "-i",
+                "--apihost", wskprops.apihost,
+                "--auth", wskprops.authKey,
+                "--namespace", namespace),
+                env = env).stdout
+            stdout should include(s"ok: whisk auth set")
+            stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
+            stdout should include(s"ok: whisk namespace set to ${namespace}")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    // If client certificate verification is off, should ingore run below tests.
+    if (!WhiskProperties.getProperty("whisk.ssl.client.verification").equals("off")) {
+        it should "set valid cert key to get expected success result for client certificate verification" in {
+            val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+            try {
+                val namespace = wsk.namespace.list().stdout.trim.split("\n").last
+                val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+                // Send request to https://<apihost>/api/v1/namespaces, wsk client passes client certificate to nginx, nginx will
+                // verify it by client ca's openwhisk-client-ca-cert.pem
+                val stdout = wsk.cli(Seq("property", "set", "-i", "--apihost", wskprops.apihost, "--auth", wskprops.authKey,
+                    "--cert", wskprops.cert, "--key", wskprops.key, "--namespace", namespace), env = env).stdout
+                stdout should include(s"ok: client cert set")
+                stdout should include(s"ok: client key set")
+                stdout should include(s"ok: whisk auth set")
+                stdout should include(s"ok: whisk API host set to ${wskprops.apihost}")
+                stdout should include(s"ok: whisk namespace set to ${namespace}")
+            } finally {
+                tmpwskprops.delete()
+            }
+        }
+
+        it should "set invalid cert key to get expected exception result for client certificate verification" in {
+            val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+            try {
+                val namespace = wsk.namespace.list().stdout.trim.split("\n").last
+                val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+                val thrown = the[Exception] thrownBy wsk.cli(Seq("property", "set", "-i", "--apihost", wskprops.apihost, "--auth", wskprops.authKey,
+                    "--cert", "invalid-cert.pem", "--key", "invalid-key.pem", "--namespace", namespace), env = env)
+                thrown.getMessage should include("cannot validate certificate")
+            } finally {
+                tmpwskprops.delete()
+            }
+        }
+    }
+
+    it should "ensure default namespace is used when a blank namespace is set" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        try {
+            val writer = new BufferedWriter(new FileWriter(tmpwskprops))
+            writer.write(s"NAMESPACE=")
+            writer.close()
+            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+            val stdout = wsk.cli(Seq("property", "get", "-i", "--namespace"), env = env).stdout
+            stdout should include regex ("whisk namespace\\s+_")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "show api build version using property file" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        try {
+            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+            wsk.cli(Seq("property", "set", "-i") ++ wskprops.overrides, env = env)
+            val stdout = wsk.cli(Seq("property", "get", "--apibuild", "-i"), env = env).stdout
+            stdout should include regex ("""(?i)whisk API build\s+201.*""")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "show api build using http apihost" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        try {
+            val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+            val apihost = s"http://${WhiskProperties.getBaseControllerAddress()}"
+            wsk.cli(Seq("property", "set", "--apihost", apihost), env = env)
+            val rr = wsk.cli(Seq("property", "get", "--apibuild", "-i"), env = env)
+            rr.stdout should not include regex("""whisk API build\s*Unknown""")
+            rr.stderr should not include regex("Unable to obtain API build information")
+            rr.stdout should include regex ("""(?i)whisk API build\s+201.*""")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "set auth in property file" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+        wsk.cli(Seq("property", "set", "--auth", "testKey"), env = env)
+        try {
+            val fileContent = FileUtils.readFileToString(tmpwskprops)
+            fileContent should include("AUTH=testKey")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "set multiple property values with single command" in {
+        val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+        val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+        val stdout = wsk.cli(Seq("property", "set", "--auth", "testKey", "--cert", "cert.pem", "--key", "key.pem", "--apihost", "openwhisk.ng.bluemix.net", "--apiversion", "v1"), env = env).stdout
+        try {
+            stdout should include regex ("ok: whisk auth set")
+            stdout should include regex ("ok: client cert set")
+            stdout should include regex ("ok: client key set")
+            stdout should include regex ("ok: whisk API host set")
+            stdout should include regex ("ok: whisk API version set")
+            val fileContent = FileUtils.readFileToString(tmpwskprops)
+            fileContent should include("AUTH=testKey")
+            fileContent should include("APIHOST=openwhisk.ng.bluemix.net")
+            fileContent should include("APIVERSION=v1")
+        } finally {
+            tmpwskprops.delete()
+        }
+    }
+
+    it should "create a trigger using property file" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val name = "listTriggers"
+            val tmpProps = File.createTempFile("wskprops", ".tmp")
+            val env = Map("WSK_CONFIG_FILE" -> tmpProps.getAbsolutePath())
+            wsk.cli(Seq("property", "set", "--auth", wp.authKey) ++ wskprops.overrides, env = env)
+            assetHelper.withCleaner(wsk.trigger, name) {
+                (trigger, _) =>
+                    wsk.cli(Seq("-i", "trigger", "create", name), env = env)
+            }
+            tmpProps.delete()
+    }
+}

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