Skip to content

Commit a946380

Browse files
committed
fix test race in udpmux
1 parent 1674737 commit a946380

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

p2p/transport/webrtc/udpmux/mux_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ func TestRemoveConnByUfrag(t *testing.T) {
151151
for i := 0; i < 10; i++ {
152152
mc1, err := m.GetConn(ufrag, conns[i].LocalAddr())
153153
require.NoError(t, err)
154-
require.Equal(t, mc1, mc)
154+
if mc1 != mc {
155+
t.Fatalf("expected the two muxed connections to be same")
156+
}
155157
}
156158

157159
// Now remove the ufrag
@@ -167,13 +169,17 @@ func TestRemoveConnByUfrag(t *testing.T) {
167169
for i := 0; i < 10; i++ {
168170
mc1, err := m.GetConn(ufrag, conns[i].LocalAddr())
169171
require.NoError(t, err)
170-
require.Equal(t, mc1, mc)
172+
if mc1 != mc {
173+
t.Fatalf("expected the two muxed connections to be same")
174+
}
171175
}
172176

173177
// Should be different even if the address is the same
174178
mc1, err := m.GetConn("a", conns[0].LocalAddr())
175179
require.NoError(t, err)
176-
require.NotEqual(t, mc1, mc)
180+
if mc1 == mc {
181+
t.Fatalf("expected the two connections to be different")
182+
}
177183
}
178184

179185
func TestMuxedConnection(t *testing.T) {

0 commit comments

Comments
 (0)