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

test(peer-and-connection-management): Implement tests #2566

Merged
merged 8 commits into from
May 13, 2024

Conversation

AlejandroCabeza
Copy link
Contributor

@AlejandroCabeza AlejandroCabeza commented Apr 3, 2024

Description

Implement tests for peer and connection management

Changes

  • Implement peer and connection management tests.
  • Fix peer added multiple times on peersByShard initialisation.
  • Remove potentially confusing clusterId parameter from newTestWakuNode (unused).
  • Add explanatory message to forceful assignment NotConnected on addPeer.

@AlejandroCabeza AlejandroCabeza self-assigned this Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2566-rln-v2-false

Built from 70cc31e

@AlejandroCabeza AlejandroCabeza force-pushed the test-peer-connection-management branch 3 times, most recently from bbebbac to 3cea89b Compare April 16, 2024 09:13
@AlejandroCabeza AlejandroCabeza marked this pull request as ready for review April 22, 2024 11:06
Copy link
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

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

Thanks for that! 🥳
I just added some non-blocking questions. Doubts that I have mostly because I may miss something :)

Aside note: I think we should invest efforts on making xasyncTests available. I think you are doing an outstanding work on those and is a pitty that they could get there forgotten. I mean, is great to add TODO for future revision but I think we should invest some time to fix those

await server2.stop()

suite "Tracked Peer Metadata":
xasyncTest "Metadata Recording":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to confirm, we have a related issue for all those tests labeled as xasyncTest right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes!

serverPeerStore.get(clientPeerId).connectedness == Connectedness.Connected

suite "Handling Connections on Different Networks":
# TODO: Implement after discv5 and peer manager's interaction is understood
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can have a 1:1 session next week to try to understand them together :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine by me :)

let
privKey = generateSecp256k1Key()
extIp = "127.0.0.1"
tcpPort = 61500u16
Copy link
Collaborator

Choose a reason for hiding this comment

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

in this case, it cannot connect because the port isn't valid right? If that's the case, maybe interesting to add a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, the port is valid. The reason it can't connect is because that server hasn't been started.

Comment on lines +163 to +164
check:
clientPeerStore.peers().len == 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

For some reason, I was expecting this to be 0 , considering the capacity == 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not following you. Can you repeat?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not following you. Can you repeat?

hahah yes, given that we are setting capacity == 1 I wonder why clientPeerStore.peers().len == 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't it make sense? What would make sense to you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't it make sense? What would make sense to you?

Sorry, I expressed myself wrongly and twice.
I mean that, given that we are setting clientPeerStore.capacity = 0 at the beginning of the test, I was expecting that no peers could get connected and therefore, I was expecting this: clientPeerStore.peers().len == 0

Copy link
Collaborator

Choose a reason for hiding this comment

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

@AlejandroCabeza - could it happen that clientPeerStore.capacity = 0 means unlimited?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's actually very likely the case, same as with the colocationLimit.


# Then the server should have all clients in its peer store
check:
serverPeerStore.peers().len == 3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because colocationLimit == 0 means "unlimited".

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

Great work and helpful even just to understand peermanager insights. Thank you!

@AlejandroCabeza AlejandroCabeza force-pushed the test-peer-connection-management branch from 6cc5401 to 66ae6a6 Compare May 13, 2024 14:45
Copy link

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2566-rln-v1

Built from 169b604

Copy link

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2566-rln-v2

Built from 169b604

@AlejandroCabeza AlejandroCabeza merged commit 49dd6c1 into master May 13, 2024
14 of 15 checks passed
@AlejandroCabeza AlejandroCabeza deleted the test-peer-connection-management branch May 13, 2024 15:25
Ivansete-status pushed a commit that referenced this pull request May 14, 2024
* Implement peer and connection management tests.
* Fix multiple peers added on initialisation.
* Remove clusterId parameter from newTestWakuNode.
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

3 participants