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/10 12:08:31 UTC

[incubator-openwhisk-cli] 06/11: Limit length of HTTP body displayed when debugging. (#2491)

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 3be8a17283ac60c1bd677cc9ffd67500e78cb941
Author: Benjamin Poole <Be...@ibm.com>
AuthorDate: Fri Aug 4 10:34:44 2017 -0400

    Limit length of HTTP body displayed when debugging. (#2491)
    
    * Limited http req body in debug
    * Added error checking
    * Removed largeFile, added asset-cleaner, removed --debug from create and refined code
    * Removed temp file creation
    * Now only limits HTTP Req/Resp Body with flag --verbose
    * Now uses json to parse and find code field
    * Update based test location, JSON parsing and comments
---
 .../scala/whisk/core/cli/test/WskBasicUsageTests.scala   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

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 70fcb5f..e0234f8 100644
--- a/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
+++ b/tests/src/test/scala/whisk/core/cli/test/WskBasicUsageTests.scala
@@ -634,6 +634,22 @@ class WskBasicUsageTests
 
             wsk.action.get(nonExistentActionName, url = Some(true), expectedExitCode = NOT_FOUND)
     }
+    it should "limit length of HTTP request and response bodies for --verbose" in withAssetCleaner(wskprops) {
+        (wp, assetHelper) =>
+            val name = "limitVerbose"
+            val msg = "will be truncated"
+            val params = Seq("-p", "bigValue", "a" * 1000)
+
+            assetHelper.withCleaner(wsk.action, name) {
+                (action, _) => action.create(name, Some(TestUtils.getTestActionFilename("echo.js")))
+            }
+
+            val truncated = wsk.cli(Seq("action", "invoke", name, "-b", "-v", "--auth", wskprops.authKey) ++ params ++ wskprops.overrides).stdout
+            msg.r.findAllIn(truncated).length shouldBe 2
+
+            val notTruncated = wsk.cli(Seq("action", "invoke", name, "-b", "-d", "--auth", wskprops.authKey) ++ params ++ wskprops.overrides).stdout
+            msg.r.findAllIn(notTruncated).length shouldBe 0
+    }
 
     behavior of "Wsk packages"
 

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