From 5bdb56da2fe16e2ca1963fc7f45ffe1294845f39 Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy Date: Wed, 12 Jun 2024 10:34:04 -0400 Subject: [PATCH 1/2] libgoal: output debug info on failure to stderr --- test/framework/fixtures/libgoalFixture.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/framework/fixtures/libgoalFixture.go b/test/framework/fixtures/libgoalFixture.go index d5140199da..80d35986db 100644 --- a/test/framework/fixtures/libgoalFixture.go +++ b/test/framework/fixtures/libgoalFixture.go @@ -145,7 +145,7 @@ func (f *LibGoalFixture) nodeExitWithError(nc *nodecontrol.NodeController, err e } debugLog := func() { - f.t.Logf("Node at %s has terminated with an error: %v. Dumping logs...", nc.GetDataDir(), err) + fmt.Fprintf(os.Stderr, "Node at %s has terminated with an error: %v. Dumping logs...", nc.GetDataDir(), err) f.dumpLogs(filepath.Join(nc.GetDataDir(), "node.log")) } @@ -158,7 +158,7 @@ func (f *LibGoalFixture) nodeExitWithError(nc *nodecontrol.NodeController, err e ws := exitError.Sys().(syscall.WaitStatus) exitCode := ws.ExitStatus() - f.t.Logf("Node at %s has terminated with error code %d (%v)", nc.GetDataDir(), exitCode, *exitError) + fmt.Fprintf(os.Stderr, "Node at %s has terminated with error code %d (%v)", nc.GetDataDir(), exitCode, *exitError) debugLog() require.NoError(f.t, err) } @@ -369,17 +369,17 @@ func (f *LibGoalFixture) ShutdownImpl(preserveData bool) { func (f *LibGoalFixture) dumpLogs(filePath string) { file, err := os.Open(filePath) if err != nil { - f.t.Logf("could not open %s", filePath) + fmt.Fprintf(os.Stderr, "could not open %s", filePath) return } defer file.Close() - f.t.Log("=================================\n") + fmt.Fprintf(os.Stderr, "=================================\n") parts := strings.Split(filePath, "/") - f.t.Logf("%s/%s:", parts[len(parts)-2], parts[len(parts)-1]) // Primary/node.log + fmt.Fprintf(os.Stderr, "%s/%s:", parts[len(parts)-2], parts[len(parts)-1]) // Primary/node.log scanner := bufio.NewScanner(file) for scanner.Scan() { - f.t.Logf(scanner.Text()) + fmt.Fprint(os.Stderr, scanner.Text()) } } From 4b2d300b249947e7c7fcd448fa5a6c9d1807210c Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy Date: Wed, 12 Jun 2024 11:14:27 -0400 Subject: [PATCH 2/2] add new line term after end of logs --- test/framework/fixtures/libgoalFixture.go | 1 + 1 file changed, 1 insertion(+) diff --git a/test/framework/fixtures/libgoalFixture.go b/test/framework/fixtures/libgoalFixture.go index 80d35986db..40269aa111 100644 --- a/test/framework/fixtures/libgoalFixture.go +++ b/test/framework/fixtures/libgoalFixture.go @@ -381,6 +381,7 @@ func (f *LibGoalFixture) dumpLogs(filePath string) { for scanner.Scan() { fmt.Fprint(os.Stderr, scanner.Text()) } + fmt.Fprintln(os.Stderr) } // intercept baseFixture.failOnError so we can clean up any algods that are still alive