-
Notifications
You must be signed in to change notification settings - Fork 40
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
test: Add integration testing for P2P. #655
Conversation
66ddb95
to
e80a384
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! 👍
Have some suggestions on the event/notification system, and the use of the GRPC stuff.
node/node.go
Outdated
} | ||
|
||
// SubsribeToPeerConnectionEvents subscribes the node to the event bus for a peer connection change. | ||
func (n *Node) SubsribeToPeerConnectionEvents() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion(blocking): I'm not sure this needs to be public. It can be set internally during Node startup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can be internal but that would mean that we would always be subscribing to it on startup. Is that something we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a good point. I'm also not sure regarding the EventBus system if Emit
calls will block if there is a cooresponding Subscribe
channel created for the given type. Which might be problematic. Let me investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some testing, it looks like everything is working fine, even with the subscribers running without anything listening on the other side.
Codecov Report
@@ Coverage Diff @@
## develop #655 +/- ##
===========================================
+ Coverage 57.30% 61.71% +4.40%
===========================================
Files 122 123 +1
Lines 14783 14895 +112
===========================================
+ Hits 8471 9192 +721
+ Misses 5585 4847 -738
- Partials 727 856 +129
|
7b2d205
to
3ac4e17
Compare
node/node.go
Outdated
} | ||
|
||
// SubsribeToPeerConnectionEvents subscribes the node to the event bus for a peer connection change. | ||
func (n *Node) SubsribeToPeerConnectionEvents() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a good point. I'm also not sure regarding the EventBus system if Emit
calls will block if there is a cooresponding Subscribe
channel created for the given type. Which might be problematic. Let me investigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contexts, contexts, contexts 😂
idea: We can break the requirement on an ordering of nodes if we obtain all nodes' PeerIDs and ports beforehand. That would simplify the DX of constructing such tests. The PeerID is a deterministic construction from a node's public key. A refactor of the key system used in the |
idea: A potential area of extension is a syntax for defining topologies and determining behavior of its links (mock network layer). |
thought: if the test suite would be async, not sequential, the timeouts would gain more meaning as failure condition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, provided the issue with usedPorts
is fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- change Seeds to SeedDocuments - Remove description and replace with comment
83dd426
to
d631f26
Compare
Relevant issue(s) Resolves sourcenetwork#564 Description This PR adds P2P integration testing functionalities. It's limited to passive syncing of nodes on a given document. The test suite starts 2 Defra nodes, waits for them to connect and then proceeds to update the commonly shared document. We then ensure that the changes on one node are reflected on the other.
Relevant issue(s)
Resolves #564
Description
This PR adds P2P integration testing functionalities. It's limited to passive syncing of nodes on a given document. The test suite starts 2 Defra nodes, waits for them to connect and then proceeds to update the commonly shared document. We then ensure that the changes on one node are reflected on the other.
Tasks
How has this been tested?
Integration tests
Specify the platform(s) on which this was tested: