diff --git a/commands/util.go b/commands/util.go index ddabb34ab..49dee6215 100644 --- a/commands/util.go +++ b/commands/util.go @@ -273,11 +273,15 @@ func makeDefaultHeader(collection interface{}) string { } func stripTimestamp(log string) (strippedLog string) { - regex := regexp.MustCompile("[a-zA-Z0-9\\s]*(stdout|stderr):\\s(.*)") + // parses out the timestamp if it exists first + // the timestamp expected format is YYYY-MM-DDTHH:MM:SS.[0-9]+Z + // an optional " stdout" or " stderr" stream identifier + // and the rest as the log line + regex := regexp.MustCompile("\\d{4}-[01]{1}\\d{1}-[0-3]{1}\\d{1}T[0-2]{1}\\d{1}:[0-6]{1}\\d{1}:[0-6]{1}\\d{1}.\\d+Z( (stdout|stderr):)?\\s(.*)") match := regex.FindStringSubmatch(log) - if len(match) > 2 && len(match[2]) > 0 { - strippedLog = match[2] + if len(match) > 3 && len(match[3]) > 0 { + strippedLog = match[3] } else { strippedLog = log } diff --git a/commands/util_test.go b/commands/util_test.go index 4e5341ad6..1350d8ab4 100644 --- a/commands/util_test.go +++ b/commands/util_test.go @@ -29,11 +29,12 @@ func TestStripTimestamp(t *testing.T) { "2018-05-02T19:33:32.829992819Z stdout: this is stdout stderr: this is still stdout": "this is stdout stderr: this is still stdout", "2018-05-02T19:33:32.829992819Z stderr: this is stderr stdout: this is still stderr": "this is stderr stdout: this is still stderr", "2018-05-02T19:33:32.89Z stdout: this is stdout": "this is stdout", - "2018-05-02T19:33:32.89Z stderr: this is stderr": "this is stderr", - "anything stdout: this is stdout": "this is stdout", - "anything stderr: this is stderr": "this is stderr", - "stdout: this is stdout": "this is stdout", - "stderr: this is stderr": "this is stderr", + "2018-05-02T19:33:32.89Z this is a msg": "this is a msg", + "2018-05-02T19:33:32.89Z this is a msg": " this is a msg", + "anything stdout: this is stdout": "anything stdout: this is stdout", + "anything stderr: this is stderr": "anything stderr: this is stderr", + "stdout: this is stdout": "stdout: this is stdout", + "stderr: this is stderr": "stderr: this is stderr", "this is stdout": "this is stdout", "this is stderr": "this is stderr", "something": "something", diff --git a/tools/travis/test_openwhisk.sh b/tools/travis/test_openwhisk.sh index a6840a712..c39a9e03d 100755 --- a/tools/travis/test_openwhisk.sh +++ b/tools/travis/test_openwhisk.sh @@ -109,4 +109,5 @@ sleep 30 # # Finally, run the integration test for the CLI # +./gradlew --console=plain --info goTest -PgoTags=unit ./gradlew --console=plain --info goTest -PgoTags=integration