Skip to content

testing(dot): migrate dot/sync tests to integration tests#2116

Merged
edwardmack merged 10 commits intodevelopmentfrom
ed/sync_tests_to_integration
May 17, 2022
Merged

testing(dot): migrate dot/sync tests to integration tests#2116
edwardmack merged 10 commits intodevelopmentfrom
ed/sync_tests_to_integration

Conversation

@edwardmack
Copy link
Copy Markdown
Contributor

Changes

  • Migrate existing non-mocked tests to integration tests, prepend file with build tag.
  • Change filenames to xx_integration_test.go

Tests

go test /dot/sync/ -short -v
go test /dot/sync/ -short -v --tags=integration

Issues

Primary Reviewer

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 16, 2021

Codecov Report

Merging #2116 (a8c0a0c) into development (368f8b6) will decrease coverage by 3.93%.
The diff coverage is n/a.

@@               Coverage Diff               @@
##           development    #2116      +/-   ##
===============================================
- Coverage        61.32%   57.39%   -3.94%     
===============================================
  Files              216      216              
  Lines            28403    28493      +90     
===============================================
- Hits             17418    16353    -1065     
- Misses            9198    10456    +1258     
+ Partials          1787     1684     -103     
Flag Coverage Δ
unit-tests 57.39% <ø> (-3.94%) ⬇️

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

Impacted Files Coverage Δ
dot/sync/block_queue.go 0.00% <0.00%> (-100.00%) ⬇️
dot/sync/outliers.go 0.00% <0.00%> (-96.16%) ⬇️
dot/sync/tip_syncer.go 0.00% <0.00%> (-83.46%) ⬇️
dot/sync/disjoint_block_set.go 0.00% <0.00%> (-82.56%) ⬇️
dot/sync/test_helpers.go 0.00% <0.00%> (-80.00%) ⬇️
dot/sync/worker.go 0.00% <0.00%> (-77.42%) ⬇️
dot/sync/bootstrap_syncer.go 0.00% <0.00%> (-74.08%) ⬇️
dot/sync/message.go 0.00% <0.00%> (-66.90%) ⬇️
dot/sync/chain_sync.go 0.00% <0.00%> (-53.73%) ⬇️
dot/sync/chain_processor.go 0.00% <0.00%> (-48.05%) ⬇️
... and 9 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 368f8b6...a8c0a0c. Read the comment docs.

@qdm12
Copy link
Copy Markdown
Contributor

qdm12 commented Dec 17, 2021

@edwardmack didn't git detect the file movements ('replace')? If you didn't modify the files much, git should had detected these are just file movements, drastically reducing deltas (correct me if I'm wrong though).
If you did modify the files enough that git doesn't detect them as file moves, maybe have a single commit moving all the files (even if compilation fails) and a second one modifying them, and we can then merge (not squash and merge) your PR so git stuff is kept in the development branch (who modified what etc.)

EDIT: you might have to remove i.e. dot/sync/bootstrap_syncer_test.go for git to detect is a file movement.

Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/disjoint_block_set_integeration_test.go
@edwardmack edwardmack force-pushed the ed/sync_tests_to_integration branch 2 times, most recently from 2b46760 to bdee8ea Compare February 4, 2022 15:56
Comment thread dot/sync/syncer_integeration_test.go
Comment thread dot/sync/tip_syncer_integeration_test.go
Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/chain_sync_integeration_test.go
Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/syncer_integeration_test.go Outdated
Comment thread dot/sync/syncer_integeration_test.go Outdated
Comment thread dot/sync/tip_syncer_integeration_test.go
@qdm12
Copy link
Copy Markdown
Contributor

qdm12 commented Feb 10, 2022

Also sorry to be the git maniac here, but perhaps you could interactively rebase on your first commit to have the following commits:

  1. file movements / deletions
  2. file changes

And then merge commits instead of squash and merge? That way file movements will be kept in history and easier to merge/rebase on for other branches (and also for git blame etc.). Otherwise git might just think it's purely new files and older files got deleted. I can help with that let me know 😉

@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
@edwardmack edwardmack changed the title testing (dot): migrate dot/sync tests to integration tests testing(dot): migrate dot/sync tests to integration tests Mar 11, 2022
@edwardmack
Copy link
Copy Markdown
Contributor Author

@qdm12 I've interactively rebased these commits, it seems to be clearer now. Please take a look again and let me know your thoughts.

Copy link
Copy Markdown
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Nice rebase! Just a few questions and suggestions to revert back to how it was to reduce deltas.

We should be able to squash and merge and git will track file movements correctly, so don't worry about adding commits 😉

Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/chain_sync_integeration_test.go Outdated
Comment thread dot/sync/disjoint_block_set_integeration_test.go
Comment thread dot/sync/message_integeration_test.go Outdated
Comment thread dot/sync/syncer_integeration_test.go Outdated
Comment thread dot/sync/syncer_integeration_test.go Outdated
@@ -647,7 +650,6 @@ func TestChainSync_doSync(t *testing.T) {
resp := &network.BlockResponseMessage{
BlockData: []*types.BlockData{
{
Hash: common.Hash{0x1},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we sure about these removals? Does the test pass locally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've re-tested, and I have re-added these. I'm not sure why I removed these.

Copy link
Copy Markdown
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Can you squash the last few commits in the 2nd commit, and then let's rebase and merge

Note in the future, you can stage your changes and then do git commit --amend && git push --force to bundle changes in the last commit.

Copy link
Copy Markdown
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Ignore the comment above; changes are minimal so the squash and merge should track file movements properly. Let's just squash and merge it 💯

Copy link
Copy Markdown
Contributor

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

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

Please add dot/sync to

github.com/ChainSafe/gossamer/lib/babe,
and then let's merge this! 👍

@edwardmack
Copy link
Copy Markdown
Contributor Author

Added dot/sync package to github integration workflow.

Copy link
Copy Markdown
Contributor

@kishansagathiya kishansagathiya left a comment

Choose a reason for hiding this comment

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

Just a few comments

  • Make sure to not modify irrelevant code.
  • Move back the line spacing that was removed.
  • TestChainProcessor_HandleJustification fails. If CI keeps timing out, run relevant integration tests locally and confirm if they pass.

Comment thread dot/sync/disjoint_block_set_integeration_test.go
Comment thread dot/sync/tip_syncer_integeration_test.go
Comment thread dot/sync/chain_processor_integration_test.go
@edwardmack
Copy link
Copy Markdown
Contributor Author

@kishansagathiya I've addressed PR comments, please re-review and let me know if any issues remain.

Copy link
Copy Markdown
Contributor

@kishansagathiya kishansagathiya left a comment

Choose a reason for hiding this comment

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

🎉

Comment thread .github/workflows/integration-tests.yml
@edwardmack edwardmack force-pushed the ed/sync_tests_to_integration branch from f9bf802 to 6880a9b Compare May 5, 2022 14:36
@edwardmack edwardmack requested review from qdm12 and removed request for arijitAD May 5, 2022 14:58
Comment thread dot/sync/syncer_integeration_test.go
@edwardmack edwardmack requested a review from qdm12 May 12, 2022 20:30
@edwardmack edwardmack merged commit e29f90c into development May 17, 2022
@edwardmack edwardmack deleted the ed/sync_tests_to_integration branch May 17, 2022 17:59
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.

Migrate dot/sync tests to integration tests

5 participants