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

UT for Version/Verack messages #853

Merged
merged 23 commits into from
Jul 3, 2019

Conversation

lock9
Copy link
Contributor

@lock9 lock9 commented Jun 24, 2019

Unit tests for RemoteNode and ProtocolHandler actors (Version and Verack only)

@shargon
Copy link
Member

shargon commented Jun 24, 2019

Could you review your indentation?
I fixed it according to visual studio default indentation here https://github.com/simplitech/neo/pull/1/files

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

Nice job, Rickk Hearth @lock9.

It will be crucial to have this part with better UTs. Great initiative.
I will check the code again asap.

@lock9
Copy link
Contributor Author

lock9 commented Jun 24, 2019

@shargon merged! Thanks!

shargon and others added 4 commits June 24, 2019 20:59
Removing shutdown;
Initializing testblockchain during class setup (only once)
…into ut-version-verack

# Conflicts:
#	neo.UnitTests/UT_RemoteNode.cs
@codecov-io
Copy link

codecov-io commented Jun 24, 2019

Codecov Report

Merging #853 into master will increase coverage by 1.16%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #853      +/-   ##
==========================================
+ Coverage   43.56%   44.72%   +1.16%     
==========================================
  Files         177      177              
  Lines       12577    12577              
==========================================
+ Hits         5479     5625     +146     
+ Misses       7098     6952     -146
Impacted Files Coverage Δ
neo/Network/P2P/Peer.cs 9.09% <0%> (+1.13%) ⬆️
neo/Network/P2P/LocalNode.cs 22.01% <0%> (+3.66%) ⬆️
neo/IO/Actors/PriorityMessageQueue.cs 93.1% <0%> (+6.89%) ⬆️
neo/Network/P2P/ProtocolHandler.cs 17.67% <0%> (+10.69%) ⬆️
neo/Network/P2P/Payloads/VersionPayload.cs 81.08% <0%> (+29.72%) ⬆️
neo/Network/P2P/RemoteNode.cs 40.88% <0%> (+37.1%) ⬆️
neo/Network/P2P/Connection.cs 42.22% <0%> (+42.22%) ⬆️
neo/Network/P2P/Capabilities/FullNodeCapability.cs 58.33% <0%> (+58.33%) ⬆️

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 bd28e4a...af1efe5. Read the comment docs.

@vncoelho
Copy link
Member

Great job, Ricardo! +1,13% that are hard to achieve :)

@igormcoelho
Copy link
Contributor

igormcoelho commented Jun 24, 2019

Ricardo, congratulations! Fine job! Can we remove your last commit? So we merge first #857

Then we format it again here after merge. It will create a much simpler merge.

[EDIT:] don't worry about the other PR... this one will probably go first.

@igormcoelho
Copy link
Contributor

igormcoelho commented Jun 29, 2019

Ricardo, I'll try to pass basic formatting at once, to simplify your PR changes here. Easier to evaluate.

[EDIT:]

Ok! Dropped from 20 files to just 5 ;) Time to review!

@igormcoelho
Copy link
Contributor

Ricardo, I think it's fine for me now, ready for approval. Please confirm if changes are good, I removed many auxiliar classes you did... but I think it's enough for testing. Otherwise we can undo my commits and try again.

igormcoelho
igormcoelho previously approved these changes Jun 29, 2019
shargon
shargon previously approved these changes Jun 30, 2019
vncoelho
vncoelho previously approved these changes Jun 30, 2019
Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

Good PR since the beginning, but even better now.

@igormcoelho igormcoelho dismissed stale reviews from vncoelho, shargon, and themself via 3ad56f7 July 1, 2019 02:39
@igormcoelho
Copy link
Contributor

igormcoelho commented Jul 1, 2019

@erikzhang please take a look at last commit... it tries to move Actor creation to NeoSystem class, through CreateActor method. This makes easier to check mailboxes, and also to create test actors when necessary (just need to mock NeoSystem class). I think NeoSystem should be available on Peer class, so it's inherited on LocalNode.. just need to find a good way to do that. Some actors may still be created outside NeoSystem, but the most important ones are there.

@erikzhang
Copy link
Member

Please revert the last commit...We should not create all actors in NeoSystem. It is not used to do this.

@igormcoelho
Copy link
Contributor

igormcoelho commented Jul 1, 2019

@erikzhang @lock9 I managed to make it work without the parameter passing, and avoiding all hard tricks... Solution was to instantiate ProtocolHandler using system.ActorSystem instead of Context, as this allows a slightly better integration, and objects are already available. Changes are very small now. It was good to listen to Erik, because code is working fine without any special changes... we need to understand these TestActors better Ricardo.

igormcoelho
igormcoelho previously approved these changes Jul 1, 2019
Copy link
Contributor

@igormcoelho igormcoelho left a comment

Choose a reason for hiding this comment

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

Only few changes now, nothing big affected. Fine for me.

shargon
shargon previously approved these changes Jul 2, 2019
@vncoelho
Copy link
Member

vncoelho commented Jul 3, 2019

Erik master yoda.

@shargon shargon merged commit 0dc5fa0 into neo-project:master Jul 3, 2019
Tommo-L pushed a commit to Tommo-L/neo that referenced this pull request Jun 22, 2020
* UT for Version/Verack messages

* Indentation

* Indentation

* Update ProtocolHandler.cs

* Fixing ClassInit;
Removing shutdown;
Initializing testblockchain during class setup (only once)

* Running formatter

* Eriks suggestion

* fix typo

* removed ProtocolFactory

* remove TestProtocolFactory

* simplify

* CreateActor

* Revert "CreateActor"

This reverts commit 3ad56f7.

* removed parameter from RemoteNode

* fix

* removed unused parameters

* format
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.

6 participants