From a5aac4228c13e43c118c99e94062bf23d1fb9846 Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy <65323360+algorandskiy@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:22:26 -0400 Subject: [PATCH] tests: debug output on LibGoalFixture failure (#6026) --- test/framework/fixtures/libgoalFixture.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/framework/fixtures/libgoalFixture.go b/test/framework/fixtures/libgoalFixture.go index f1a13111a0..d5140199da 100644 --- a/test/framework/fixtures/libgoalFixture.go +++ b/test/framework/fixtures/libgoalFixture.go @@ -144,20 +144,23 @@ func (f *LibGoalFixture) nodeExitWithError(nc *nodecontrol.NodeController, err e return } - defer func() { + debugLog := func() { f.t.Logf("Node at %s has terminated with an error: %v. Dumping logs...", nc.GetDataDir(), err) f.dumpLogs(filepath.Join(nc.GetDataDir(), "node.log")) - }() + } exitError, ok := err.(*exec.ExitError) if !ok { - require.NoError(f.t, err, "Node at %s has terminated with an error", nc.GetDataDir()) + debugLog() + require.NoError(f.t, err) return } ws := exitError.Sys().(syscall.WaitStatus) exitCode := ws.ExitStatus() - require.NoError(f.t, err, "Node at %s has terminated with error code %d", nc.GetDataDir(), exitCode) + f.t.Logf("Node at %s has terminated with error code %d (%v)", nc.GetDataDir(), exitCode, *exitError) + debugLog() + require.NoError(f.t, err) } func (f *LibGoalFixture) importRootKeys(lg *libgoal.Client, dataDir string) {