Created
October 30, 2019 18:02
-
-
Save artemnikitin/b959d6f59d8bbad1ee5b5bb5947b7814 to your computer and use it in GitHub Desktop.
Cleanup test output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replacement for https://github.com/elastic/cloud-on-k8s/blob/master/test/e2e/cmd/run/run.go#L346-L365 | |
var f *os.File | |
if h.logToFile { | |
f, err = os.Create(testsLogFile) | |
if err != nil { | |
log.Error(err, "Can't create file for test output") | |
return | |
} | |
defer f.Close() | |
} | |
scanner := bufio.NewScanner(stream) | |
for scanner.Scan() { | |
text := scanner.Text() | |
fmt.Println(text) | |
if h.logToFile { | |
err = json.Unmarshal([]byte(text), &GoTestJSON{}) | |
if err == nil { | |
f.WriteString(text) | |
f.WriteString("\n") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment