From e084128d05a2129ffd7268b567e96b37dd4bc78f Mon Sep 17 00:00:00 2001 From: Quique Llorente Date: Mon, 30 Sep 2019 10:34:14 +0200 Subject: [PATCH] Format k8s logs so we get a proper new line for nmstate --- test/e2e/utils.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/e2e/utils.go b/test/e2e/utils.go index 1633ab5be8..722d0cf03e 100644 --- a/test/e2e/utils.go +++ b/test/e2e/utils.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "io" + "io/ioutil" "os/exec" "strings" "testing" @@ -57,12 +58,14 @@ func writePodsLogs(namespace string, sinceTime time.Time, writer io.Writer) erro continue } defer podLogs.Close() - _, err = io.Copy(writer, podLogs) + //_, err = io.Copy(writer, podLogs) + rawLogs, err := ioutil.ReadAll(podLogs) if err != nil { io.WriteString(writer, fmt.Sprintf("error in copy information from podLogs to buf: %v\n", err)) continue } - + formattedLogs := strings.ReplaceAll(string(rawLogs), "\\n", "\n") + io.WriteString(writer, formattedLogs) } return nil }