Skip to content

Commit

Permalink
(API change): Use different mocks.UDPLikeConn for concurrent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kelmenhorst committed Jun 19, 2023
1 parent 17aef9d commit 35c1a52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/measurexlite/quic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func TestNewQUICDialerWithoutResolver(t *testing.T) {
pconn := &mocks.UDPLikeConn{
MockLocalAddr: func() net.Addr {
return &net.UDPAddr{
// quic-go does not allow the use of the same net.PacketConn for multiple "Dial"
// calls (unless a quic.Transport is used), so we have to make sure to mock local
// addresses with different ports, as tests run in parallel.
Port: 0,
}
},
Expand Down Expand Up @@ -207,7 +210,10 @@ func TestNewQUICDialerWithoutResolver(t *testing.T) {
pconn := &mocks.UDPLikeConn{
MockLocalAddr: func() net.Addr {
return &net.UDPAddr{
Port: 0,
// quic-go does not allow the use of the same net.PacketConn for multiple "Dial"
// calls (unless a quic.Transport is used), so we have to make sure to mock local
// addresses with different ports, as tests run in parallel.
Port: 1,
}
},
MockRemoteAddr: func() net.Addr {
Expand Down
3 changes: 3 additions & 0 deletions internal/measurexlite/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ func TestTrace(t *testing.T) {
pconn := &mocks.UDPLikeConn{
MockLocalAddr: func() net.Addr {
return &net.UDPAddr{
// quic-go does not allow the use of the same net.PacketConn for multiple "Dial"
// calls (unless a quic.Transport is used), so we have to make sure to mock local
// addresses with different ports, as tests run in parallel.
Port: 0,
}
},
Expand Down

0 comments on commit 35c1a52

Please sign in to comment.