Collect serial output when test fails in node e2e.

This commit is contained in:
Random-Liu
2016-11-29 12:18:14 -08:00
parent a2d5df40af
commit 6d4e457f1f
2 changed files with 28 additions and 1 deletions

View File

@@ -350,6 +350,19 @@ func getTestArtifacts(host, testDir string) error {
return nil
}
// WriteLog is a temporary function to make it possible to write log
// in the runner. This is used to collect serial console log.
// TODO(random-liu): Use the log-dump script in cluster e2e.
func WriteLog(host, filename, content string) error {
f, err := os.Create(filepath.Join(*resultsDir, host, filename))
if err != nil {
return err
}
defer f.Close()
_, err = f.WriteString(content)
return err
}
// getSSHCommand handles proper quoting so that multiple commands are executed in the same shell over ssh
func getSSHCommand(sep string, args ...string) string {
return fmt.Sprintf("'%s'", strings.Join(args, sep))