Skip to content

Commit

Permalink
tests: debug output on LibGoalFixture failure (#6026)
Browse files Browse the repository at this point in the history
  • Loading branch information
algorandskiy authored Jun 11, 2024
1 parent 985512b commit a5aac42
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/framework/fixtures/libgoalFixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a5aac42

Please sign in to comment.