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 TestDealPublisher #7173

Merged
merged 2 commits into from
Aug 25, 2021
Merged

fix TestDealPublisher #7173

merged 2 commits into from
Aug 25, 2021

Conversation

Stebalien
Copy link
Member

This test should be mostly deterministic, but is still failing. I believe this is because:

  1. We record the "start" time before starting the timer.
  2. In the test, we increment the clock till right after the timer should fire, if the timer start time matches the recorded start time.
  3. If we happen to advance the mock clock between recording the time and starting the timer, the timer will never fire.

Unfortunately, I can't reproduce this locally (at all) so I'm mostly just guessing.

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.
@Stebalien Stebalien requested a review from a team as a code owner August 24, 2021 18:09
@@ -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]
Copy link
Member Author

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

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

codecov bot commented Aug 24, 2021

Codecov Report

Merging #7173 (add699d) into master (263a85c) will increase coverage by 0.01%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
markets/storageadapter/dealpublisher.go 84.18% <71.42%> (-0.57%) ⬇️
storage/wdpost_sched.go 81.18% <0.00%> (-3.97%) ⬇️
blockstore/buffered.go 40.00% <0.00%> (-2.23%) ⬇️
chain/exchange/client.go 53.67% <0.00%> (-1.74%) ⬇️
chain/messagepool/selection.go 80.93% <0.00%> (-0.41%) ⬇️
chain/sync.go 61.42% <0.00%> (ø)
chain/actors/builtin/miner/v3.go 36.53% <0.00%> (+0.61%) ⬆️
chain/sync_manager.go 67.39% <0.00%> (+0.62%) ⬆️
paychmgr/simple.go 80.86% <0.00%> (+0.92%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 263a85c...add699d. Read the comment docs.

@Stebalien
Copy link
Member Author

codecove -> 🤦

@Stebalien
Copy link
Member Author

Flaky test disabled in #7176.

@arajasek arajasek merged commit 0c0fd00 into master Aug 25, 2021
@arajasek arajasek deleted the fix/publish-test-redux branch August 25, 2021 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants