You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2023/06/02 09:59:13 UTC

[plc4x] branch develop updated: test(plc4go): fix Jenkins not being able to parse log outputs.

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

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new fd85e77676 test(plc4go): fix Jenkins not being able to parse log outputs.
fd85e77676 is described below

commit fd85e77676b62baf3a71942245006176bad76be9
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Jun 2 11:59:04 2023 +0200

    test(plc4go): fix Jenkins not being able to parse log outputs.
---
 plc4go/spi/testutils/TestUtils.go | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/plc4go/spi/testutils/TestUtils.go b/plc4go/spi/testutils/TestUtils.go
index af5ad52446..7bdd2926fc 100644
--- a/plc4go/spi/testutils/TestUtils.go
+++ b/plc4go/spi/testutils/TestUtils.go
@@ -106,7 +106,17 @@ func CompareResults(t *testing.T, actualString []byte, referenceString []byte) e
 
 // ProduceTestingLogger produces a logger which redirects to testing.T
 func ProduceTestingLogger(t *testing.T) zerolog.Logger {
-	return zerolog.New(zerolog.NewConsoleWriter(zerolog.ConsoleTestWriter(t)))
+	return zerolog.New(
+		zerolog.NewConsoleWriter(
+			zerolog.ConsoleTestWriter(t),
+			func(w *zerolog.ConsoleWriter) {
+				onJenkins := os.Getenv("JENKINS_URL") != ""
+				if onJenkins {
+					w.NoColor = true
+				}
+			},
+		),
+	)
 }
 
 // SetToTestingLogger sets logger to  ProduceTestingLogger and resets it on cleanup