Skip to content
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

Merged
merged 8 commits into from
Aug 12, 2022

Conversation

ghost
Copy link

@ghost ghost commented Aug 10, 2022

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.

@ghost ghost added the Team Carbon-11 label Aug 10, 2022
@ghost ghost requested a review from algorandskiy August 10, 2022 15:38
@ghost ghost self-assigned this Aug 10, 2022
@@ -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")
Copy link
Contributor

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

@ghost ghost added the Bug-Fix label Aug 10, 2022
f.t.Logf("txn failed to confirm: ", addr, txid)
pendingTxns, err := f.AlgodClient.GetPendingTransactions(0)
if err == nil {
f.t.Logf("pending: ", pendingTxns)
Copy link
Contributor

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
Copy link

codecov bot commented Aug 10, 2022

Codecov Report

Merging #4384 (fad52b2) into master (701d431) will decrease coverage by 0.03%.
The diff coverage is n/a.

@@            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              
Impacted Files Coverage Δ
network/wsPeer.go 65.47% <0.00%> (-2.20%) ⬇️
ledger/tracker.go 78.63% <0.00%> (-1.71%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
ledger/acctupdates.go 69.92% <0.00%> (-0.61%) ⬇️
network/requestTracker.go 71.12% <0.00%> (-0.44%) ⬇️
cmd/algoh/blockWatcher.go 80.95% <0.00%> (+3.17%) ⬆️

📣 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")
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants