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

testing(dot/sync): create dot sync unit tests #2261

Merged
merged 89 commits into from
Jun 13, 2022

Conversation

edwardmack
Copy link
Member

@edwardmack edwardmack commented Feb 1, 2022

Changes

  • Create unit tests for dot/sync packages: chain_processor_test.go, chain_sync_test.go, disjoint_block_set_test.go, massage_test.go, outliers_test.go, syncer_test.go, tip_syncer_test.go
  • tparallel linter
  • remove nil block check in handleBlock

Tests

go test ./dot/sync/... -v

Issues

Primary Reviewer

@codecov
Copy link

codecov bot commented Feb 4, 2022

Codecov Report

Merging #2261 (35962eb) into development (6d22c23) will increase coverage by 4.59%.
The diff coverage is 55.49%.

@@               Coverage Diff               @@
##           development    #2261      +/-   ##
===============================================
+ Coverage        57.34%   61.94%   +4.59%     
===============================================
  Files              215      215              
  Lines            28417    28407      -10     
===============================================
+ Hits             16296    17596    +1300     
+ Misses           10442     9063    -1379     
- Partials          1679     1748      +69     
Flag Coverage Δ
unit-tests 61.94% <55.49%> (+4.59%) ⬆️

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

Impacted Files Coverage Δ
dot/sync/disjoint_block_set.go 75.58% <ø> (+75.58%) ⬆️
dot/sync/test_helpers.go 0.00% <ø> (ø)
lib/runtime/constants.go 0.00% <ø> (ø)
lib/runtime/test_helpers.go 7.94% <0.00%> (-0.65%) ⬇️
dot/peerset/peerset.go 49.34% <42.85%> (-0.23%) ⬇️
dot/state/epoch.go 49.53% <50.00%> (+0.23%) ⬆️
dot/sync/chain_sync.go 76.12% <93.42%> (+76.12%) ⬆️
dot/sync/chain_processor.go 97.60% <100.00%> (+97.60%) ⬆️
dot/sync/outliers.go 96.15% <100.00%> (+96.15%) ⬆️
dot/sync/syncer.go 91.25% <100.00%> (+91.25%) ⬆️
... and 19 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 2fa5d8a...35962eb. Read the comment docs.

@edwardmack edwardmack force-pushed the ed/sync_unit_tests branch 2 times, most recently from e8d4957 to 1d3de9d Compare February 4, 2022 20:26
dot/network/service.go Outdated Show resolved Hide resolved
dot/sync/syncer_test.go Outdated Show resolved Hide resolved
@edwardmack edwardmack force-pushed the ed/sync_tests_to_integration branch 2 times, most recently from 324c1f6 to b6073f0 Compare March 11, 2022 21:53
@timwu20
Copy link
Contributor

timwu20 commented Apr 5, 2022

@edwardmack looks like a mock is failing on an assertion.

@edwardmack edwardmack marked this pull request as draft April 6, 2022 20:56
@edwardmack edwardmack changed the title testing (dot/sync) create dot sync unit tests testing(dot/sync): create dot sync unit tests Apr 7, 2022
@edwardmack edwardmack marked this pull request as ready for review April 11, 2022 14:51
Copy link
Contributor

@timwu20 timwu20 left a comment

Choose a reason for hiding this comment

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

Fantastic work Ed! I added a few suggestions. I see a lot of improvement in this PR. 🚀

dot/sync/bootstrap_syncer_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_test.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/message_test.go Outdated Show resolved Hide resolved
dot/sync/syncer_test.go Show resolved Hide resolved
dot/sync/chain_processor.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/bootstrap_syncer_test.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_integeration_test.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_integeration_test.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_test.go Outdated Show resolved Hide resolved
lib/runtime/interface.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_integeration_test.go Outdated Show resolved Hide resolved
dot/sync/chain_sync_integeration_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
dot/sync/disjoint_block_set_test.go Outdated Show resolved Hide resolved
@edwardmack
Copy link
Member Author

This should be ready for a re-review. Note that I've added //nolint:govet to places where fields test struct was replaced with disjointBlockSet directly since disjointBlockSet contains a sync.RWMutex. Let me know if there is a better way to handle this.

Copy link
Member

@EclesioMeloJunior EclesioMeloJunior left a comment

Choose a reason for hiding this comment

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

LGTM! Just small changes

dot/sync/bootstrap_syncer_test.go Show resolved Hide resolved
dot/sync/chain_sync.go Outdated Show resolved Hide resolved
lib/runtime/interface.go Outdated Show resolved Hide resolved
Copy link
Contributor

@timwu20 timwu20 left a comment

Choose a reason for hiding this comment

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

Really good work Ed!

dot/sync/tip_syncer_integeration_test.go Outdated Show resolved Hide resolved
dot/sync/bootstrap_syncer_test.go Outdated Show resolved Hide resolved
dot/sync/bootstrap_syncer_test.go Outdated Show resolved Hide resolved
dot/sync/bootstrap_syncer_test.go Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
dot/sync/chain_processor_test.go Outdated Show resolved Hide resolved
@edwardmack edwardmack merged commit 16313f8 into development Jun 13, 2022
@edwardmack edwardmack deleted the ed/sync_unit_tests branch June 13, 2022 16:31
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.

Create dot/sync unit tests
6 participants