-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 TestDealPublisher #7173
fix TestDealPublisher #7173
Conversation
1. No need to slice a slice. 2. Idiomatic filter (https://github.com/golang/go/wiki/SliceTricks).
Otherwise, our nice and deterministic test may keep repeatedly setting the time to _right_ before the timer fires.
@@ -384,12 +388,12 @@ func pieceCids(deals []market2.ClientDealProposal) string { | |||
|
|||
// filter out deals that have been cancelled | |||
func (p *DealPublisher) filterCancelledDeals() { | |||
i := 0 | |||
filtered := p.pending[:0] |
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.
This was just a drive-by fix to make the logic here easier to reason about.
@@ -257,7 +261,7 @@ func (p *DealPublisher) publishAllDeals() { | |||
|
|||
// Filter out any deals that have been cancelled | |||
p.filterCancelledDeals() | |||
deals := p.pending[:] | |||
deals := p.pending |
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.
Also a drive-by fix. There's no need to do this unless p.pending
is an array.
Codecov Report
@@ Coverage Diff @@
## master #7173 +/- ##
==========================================
+ Coverage 34.85% 34.87% +0.01%
==========================================
Files 684 684
Lines 80137 80137
==========================================
+ Hits 27934 27945 +11
+ Misses 46518 46510 -8
+ Partials 5685 5682 -3
Continue to review full report at Codecov.
|
codecove -> 🤦 |
Flaky test disabled in #7176. |
This test should be mostly deterministic, but is still failing. I believe this is because:
Unfortunately, I can't reproduce this locally (at all) so I'm mostly just guessing.