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

lburgazzoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 935cb3aecd7ecc209101ab25188551e73f3f4350
Author: Luca Burgazzoli <lburgazz...@gmail.com>
AuthorDate: Wed Jan 18 10:25:22 2023 +0100

    chore(test): improve maven log test
    
    - support for MAVEN_CMD env var as camel-k does
    - run maven in batch mode to avoid including ASCII escaping chars in the
      error message which could cause the test to fail in some evironments
---
 pkg/util/maven/maven_log_test.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pkg/util/maven/maven_log_test.go b/pkg/util/maven/maven_log_test.go
index 96c1441d4..a9c18ada0 100644
--- a/pkg/util/maven/maven_log_test.go
+++ b/pkg/util/maven/maven_log_test.go
@@ -19,6 +19,7 @@ package maven
 
 import (
        "context"
+       "os"
        "os/exec"
        "testing"
 
@@ -27,7 +28,12 @@ import (
 )
 
 func TestRunAndLogErrorMvn(t *testing.T) {
-       cmd := exec.CommandContext(context.Background(), "mvn", "package")
+       mavenCmd, ok := os.LookupEnv("MAVEN_CMD")
+       if !ok {
+               mavenCmd = "mvn"
+       }
+
+       cmd := exec.CommandContext(context.Background(), mavenCmd, "package", 
"-B")
        err := util.RunAndLog(context.Background(), cmd, mavenLogHandler, 
mavenLogHandler)
 
        assert.NotNil(t, err)

Reply via email to