From 5e8974fec227f0c1fe9cd885df49c9ce5bc3883b 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/e2e/utils.go b/test/e2e/utils.go index 1633ab5be..a5259323d 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,13 @@ func writePodsLogs(namespace string, sinceTime time.Time, writer io.Writer) erro continue } defer podLogs.Close() - _, 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)) + io.WriteString(writer, fmt.Sprintf("error reading kubernetes-nmstate logs: %v\n", err)) continue } - + formattedLogs := strings.Replace(string(rawLogs), "\\n", "\n", -1) + io.WriteString(writer, formattedLogs) } return nil }