You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/08/24 21:27:31 UTC

[incubator-openwhisk-wskdeploy] branch master updated: Adding print statements (#387)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3cc38c9  Adding print statements (#387)
3cc38c9 is described below

commit 3cc38c9b0815c0cb4b73741cf2fc8f44015bfa47
Author: Priti Desai <pd...@us.ibm.com>
AuthorDate: Thu Aug 24 14:27:30 2017 -0700

    Adding print statements (#387)
    
    I am trying to change integration tests to make sure they
    are running in Travis. We have lot of discrepancy in reporting
    errors in case of failure and it results in Travis build being
    successful. I want to add these print statements so that
    we can see if what exactly is happening in Travis until we merge
    the fix for integration tests itself.
---
 tests/src/integration/common/wskdeploy.go | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/tests/src/integration/common/wskdeploy.go b/tests/src/integration/common/wskdeploy.go
index eb0cb32..a18fa59 100644
--- a/tests/src/integration/common/wskdeploy.go
+++ b/tests/src/integration/common/wskdeploy.go
@@ -21,6 +21,7 @@ import (
 	"os"
 	"os/exec"
 	"fmt"
+	"strings"
 )
 
 const cmd = "wskdeploy"
@@ -41,13 +42,33 @@ func NewWskWithPath(path string) *Wskdeploy {
 	return &dep
 }
 
+func printCommand(cmd *exec.Cmd) {
+	fmt.Printf("==> Executing: %s\n", strings.Join(cmd.Args, " "))
+}
+
+func printError(err error) {
+	if err != nil {
+		os.Stderr.WriteString(fmt.Sprintf("==> Error: %s\n", err.Error()))
+	}
+}
+
+func printOutput(outs []byte) {
+	if len(outs) > 0 {
+		fmt.Printf("==> Output: %s\n", string(outs))
+	}
+}
+
 func (wskdeploy *Wskdeploy) RunCommand(s ...string) ([]byte, error) {
 	command := exec.Command(wskdeploy.Path, s...)
 	command.Dir = wskdeploy.Dir
+
+	printCommand(command)
+
 	output, err := command.CombinedOutput()
-	if err != nil {
-		fmt.Println(err.Error())
-	}
+
+	printOutput(output)
+	printError(err)
+
 	return output, err
 }
 

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