-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: master
Are you sure you want to change the base?
Add host with circuitv2 to integration test #3162
Conversation
p2p/test/transport/transport_test.go
Outdated
func TestConnRelay(t *testing.T) { | ||
for _, tc := range transportsToTest { | ||
if tc.Name != RelayTestOnTransportName { | ||
continue |
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.
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.
var transportsToTest = []TransportTestCase{ | ||
{ |
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.
Add another item to this list with Name: "circuit-v2"
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() |
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.
We don't need this test. We want to run all the transport integration tests for the circuit relay transport.
if opts.NoListen { | ||
libp2pOpts = append(libp2pOpts, libp2p.NoListenAddrs) |
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.
You need to add the relay transport to the host, if not already present.
libp2pOpts = append(libp2pOpts, libp2p.ListenAddrStrings("/ip4/127.0.0.1/udp/0/quic-v1")) | ||
} |
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.
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)
Description
circuitv2
to transport integration test