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

fix(test): submit loop test uses no op logger and prints more diagnostics #1003

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions block/submit_loop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func testSubmitLoopInner(
}
// producer shall not get too far ahead
absoluteMax := (args.batchSkew + 1) * args.batchBytes // +1 is because the producer is always blocked after the fact
require.True(t, nProducedBytes.Load() < absoluteMax)
nProduced := nProducedBytes.Load()
require.True(t, nProduced < absoluteMax, "produced bytes not less than maximum", "nProduced", nProduced, "max", absoluteMax)
}
}()
for {
Expand Down Expand Up @@ -99,13 +100,14 @@ func testSubmitLoopInner(

timeLastProgressT := time.Unix(timeLastProgress.Load(), 0)
absoluteMax := int64(1.5 * float64(args.maxTime)) // allow some leeway for code execution
require.True(t, time.Since(timeLastProgressT).Milliseconds() < absoluteMax)
timeSinceLast := time.Since(timeLastProgressT).Milliseconds()
require.True(t, timeSinceLast < absoluteMax, "too long since last update", "timeSinceLast", timeSinceLast, "max", absoluteMax)

timeLastProgress.Store(time.Now().Unix()) // we have submitted batch
return uint64(consumed), nil
}

block.SubmitLoopInner(ctx, log.TestingLogger(), producedBytesC, args.batchSkew, args.maxTime, args.batchBytes, submitBatch)
block.SubmitLoopInner(ctx, log.NewNopLogger(), producedBytesC, args.batchSkew, args.maxTime, args.batchBytes, submitBatch)
}

// Make sure the producer does not get too far ahead
Expand Down
Loading