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

[Sealing] AssignmentCollectorTree unit tests #1134

Merged
merged 22 commits into from
Aug 31, 2021

Conversation

durkmurder
Copy link
Member

flow-go/issues/5719

Context:

This PR adds separate test suite for AssignmentCollectorTree. Contains some refactoring of testing logic of approvals suite.

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2021

Codecov Report

Merging #1134 (d52c834) into master (8f728bd) will increase coverage by 0.37%.
The diff coverage is 89.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1134      +/-   ##
==========================================
+ Coverage   55.80%   56.17%   +0.37%     
==========================================
  Files         484      484              
  Lines       29788    29807      +19     
==========================================
+ Hits        16622    16743     +121     
+ Misses      10897    10779     -118     
- Partials     2269     2285      +16     
Flag Coverage Δ
unittests 56.17% <89.74%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...sus/approvals/assignment_collector_statemachine.go 50.00% <ø> (+4.80%) ⬆️
engine/consensus/approvals/testutil.go 87.69% <89.18%> (-3.98%) ⬇️
...e/consensus/approvals/assignment_collector_tree.go 78.35% <100.00%> (+78.35%) ⬆️
...ngine/common/synchronization/finalized_snapshot.go 66.66% <0.00%> (-5.13%) ⬇️
cmd/util/ledger/migrations/storage_v4.go 41.56% <0.00%> (-0.61%) ⬇️
module/mempool/epochs/transactions.go 100.00% <0.00%> (+5.26%) ⬆️

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 8f728bd...d52c834. Read the comment docs.

Comment on lines 269 to 273
// leveled forest doesn't treat this case as error, we shouldn't create collectors
// for vertexes lower that forest.LowestLevel
if vertex.Level() < t.forest.LowestLevel {
return nil, fmt.Errorf("could not add collector with height lower than the lowest level")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, then we could move it up right after the lock

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Leo:
to me it would also be more intuitive if this check happened right after

t.lock.Lock()
defer t.lock.Unlock()

engine/consensus/approvals/assignment_collector_tree.go Outdated Show resolved Hide resolved
Comment on lines 269 to 273
// leveled forest doesn't treat this case as error, we shouldn't create collectors
// for vertexes lower that forest.LowestLevel
if vertex.Level() < t.forest.LowestLevel {
return nil, fmt.Errorf("could not add collector with height lower than the lowest level")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Leo:
to me it would also be more intuitive if this check happened right after

t.lock.Lock()
defer t.lock.Unlock()

Copy link
Member

@AlexHentschel AlexHentschel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Thanks for the solid test!
Suggested lots of little revisions. I am happy if you address the comments and then just merge (no further review required).

@durkmurder durkmurder merged commit b322b29 into master Aug 31, 2021
@durkmurder durkmurder deleted the yurii/5719-assignment-collector-unit-tests branch August 31, 2021 12:42
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.

None yet

6 participants