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/11/15 17:34:15 UTC

[incubator-openwhisk-cli] 04/16: Fix issue with trailing spaces and handle comments in the property file. (#2772)

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 2ac591e23fd10c72a3506b67147e5ecbdd445be8
Author: Gabriel Nicolas Avellaneda <av...@gmail.com>
AuthorDate: Fri Oct 20 01:54:19 2017 -0200

    Fix issue with trailing spaces and handle comments in the property file. (#2772)
    
    * Fix issue with trailing spaces and handle comments in the property file.
    
    * Cleanup to follow coding style
    
    * Added Scala test for verifying that wskprops can correctly handle trailing white spaces and comments
    
    * Added spaces after the comment
---
 .../test/scala/whisk/core/cli/test/WskConfigTests.scala    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala b/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
index 795a26a..e4e14e9 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskConfigTests.scala
@@ -132,6 +132,20 @@ class WskConfigTests extends TestHelpers with WskTestHelpers {
     }
   }
 
+  it should "get apihost removing any trailing white spaces and line comments" in {
+    val tmpwskprops = File.createTempFile("wskprops", ".tmp")
+    try {
+      val writer = new BufferedWriter(new FileWriter(tmpwskprops))
+      writer.write(s"APIHOST=http://localhost:10001    # This is a comment!   ")
+      writer.close()
+      val env = Map("WSK_CONFIG_FILE" -> tmpwskprops.getAbsolutePath())
+      val stdout = wsk.cli(Seq("property", "get", "-i", "--apihost"), env = env).stdout
+      stdout should include regex ("whisk API host\\s+http://localhost:10001$")
+    } finally {
+      tmpwskprops.delete()
+    }
+  }
+
   it should "set apihost, auth, and namespace" in {
     val tmpwskprops = File.createTempFile("wskprops", ".tmp")
     try {

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