-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests: Add logging to libgoal fixture on failure #4384
tests: Add logging to libgoal fixture on failure #4384
Conversation
@@ -324,6 +328,22 @@ func (f *LibGoalFixture) ShutdownImpl(preserveData bool) { | |||
} | |||
} | |||
|
|||
// dumpLogs prints out node.log files for the running nodes | |||
func (f *LibGoalFixture) dumpLogs(dataDir string) { | |||
file, err := os.Open(dataDir + "/node.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please limit to ~100 lines, and dump algod-err.log and algod-out.log if not empty as well
f.t.Logf("txn failed to confirm: ", addr, txid) | ||
pendingTxns, err := f.AlgodClient.GetPendingTransactions(0) | ||
if err == nil { | ||
f.t.Logf("pending: ", pendingTxns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's print out both lists of txnids - txidsAndAddresses and pending
Codecov Report
@@ Coverage Diff @@
## master #4384 +/- ##
==========================================
- Coverage 55.63% 55.59% -0.04%
==========================================
Files 403 403
Lines 50805 50805
==========================================
- Hits 28263 28246 -17
- Misses 20148 20165 +17
Partials 2394 2394
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -311,6 +312,10 @@ func (f *LibGoalFixture) ShutdownImpl(preserveData bool) { | |||
f.NC.StopKMD() | |||
if preserveData { | |||
f.network.Stop(f.binDir) | |||
f.dumpLogs(f.PrimaryDataDir() + "/node.log") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we kind of unofficially support Windows, could you also use filepath.Join(f.PrimaryDataDir(), "node.log")
instead here and below?
Co-authored-by: Pavel Zbitskiy <[email protected]>
Summary
When a test running the libgoal fixture, flakes, it is difficult for us to diagnose the problem. Print out node.log to the test console so we can analyze the problem.
Test Plan
Purposely failed test to check whether logs were dumped.