You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2022/11/30 10:31:00 UTC
[camel-k] branch main updated: chore(test) : TestRunAndLog to pass on mac os
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 03b49ea00 chore(test) : TestRunAndLog to pass on mac os
03b49ea00 is described below
commit 03b49ea00456f01042f569b72ab8609b74bbe712
Author: yugo-horie <u5...@gmail.com>
AuthorDate: Thu Nov 17 13:20:32 2022 +0900
chore(test) : TestRunAndLog to pass on mac os
* Fix: #3813
Signed-off-by: yugo-horie <u5...@gmail.com>
---
pkg/util/command_test.go | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/pkg/util/command_test.go b/pkg/util/command_test.go
index 98187b097..782f1804e 100644
--- a/pkg/util/command_test.go
+++ b/pkg/util/command_test.go
@@ -21,7 +21,6 @@ import (
"context"
"fmt"
"os/exec"
- "strings"
"testing"
"github.com/stretchr/testify/assert"
@@ -30,17 +29,11 @@ import (
var (
loggerInfo = func(s string) string {
fmt.Println("OUT:", s)
- if strings.Contains(s, "invalid") {
- return s
- }
- return ""
+ return s
}
loggerError = func(s string) string {
fmt.Println("ERR:", s)
- if strings.Contains(s, "invalid") {
- return s
- }
- return ""
+ return s
}
)
@@ -52,9 +45,9 @@ func TestRunAndLog(t *testing.T) {
}
func TestRunAndLogInvalid(t *testing.T) {
- cmd := exec.CommandContext(context.Background(), "date", "-dsa")
+ cmd := exec.CommandContext(context.Background(), "go", "help", "dsa")
err := RunAndLog(context.Background(), cmd, loggerInfo, loggerError)
assert.NotNil(t, err)
- assert.ErrorContains(t, err, "exit status 1")
+ assert.Equal(t, "go help dsa: unknown help topic. Run 'go help'.: exit status 2", err.Error())
}