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

Add host with circuitv2 to integration test #3162

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

badgooooor
Copy link
Contributor

Description

@badgooooor badgooooor marked this pull request as ready for review February 5, 2025 14:07
Comment on lines 871 to 874
func TestConnRelay(t *testing.T) {
for _, tc := range transportsToTest {
if tc.Name != RelayTestOnTransportName {
continue
Copy link
Member

Choose a reason for hiding this comment

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

We don't want a separate test for Relay. We want to run all integration tests with a Relay transport.

This package has a bunch of tests that we want all transports to satisfy, like ConnGater Test, ResourceManager Test, PingPong on streams, etc. We should add another transport to the list of already present transports which connects hosts over a circuit relay address.

At the moment it's fine to ignore which underlying transport is used to make the relay connection, and just use QUIC as the underlying transport. Ideally, any problem in the underlying transports should be caught when testing that specifc transport.

Comment on lines 82 to 83
var transportsToTest = []TransportTestCase{
{
Copy link
Member

Choose a reason for hiding this comment

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

Add another item to this list with Name: "circuit-v2"

@badgooooor badgooooor requested a review from sukunrt February 15, 2025 05:20
Comment on lines +897 to +901
func TestConnRelay(t *testing.T) {
for _, tc := range transportsToTest {
t.Run(tc.Name, func(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this test. We want to run all the transport integration tests for the circuit relay transport.

Comment on lines +244 to +245
if opts.NoListen {
libp2pOpts = append(libp2pOpts, libp2p.NoListenAddrs)
Copy link
Member

Choose a reason for hiding this comment

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

You need to add the relay transport to the host, if not already present.

Comment on lines +247 to +248
libp2pOpts = append(libp2pOpts, libp2p.ListenAddrStrings("/ip4/127.0.0.1/udp/0/quic-v1"))
}
Copy link
Member

Choose a reason for hiding this comment

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

You need this host to obtain a relay reservation with a relay server.

For the listen side, you'll need to start 2 hosts. 1 relay host, 1 listener node. The listener node will obtain a relay reservation with the relay host and then advertise its address using AddressFactory(https://github.com/libp2p/go-libp2p/blob/master/options.go#L260)

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.

Add transport integration tests for circuitv2
2 participants