mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Defalke test target pkg/tcpip/stack:bridge_test.
There is a race in the test between WritePacketToRemote and FindFDBEntry, even though it rarely happens, we just enforce FindFDBEntry to wait for WritePacketToRemote's completion here. PiperOrigin-RevId: 721747159
This commit is contained in:
@@ -17,6 +17,7 @@ package bridge_test
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gvisor.dev/gvisor/pkg/buffer"
|
||||
"gvisor.dev/gvisor/pkg/refs"
|
||||
@@ -240,7 +241,11 @@ func TestBridgeFDB(t *testing.T) {
|
||||
// When forwarding the packet via the bridge device, the packet's
|
||||
// source MAC address will be used as lookup key to the bridge
|
||||
// FDB.
|
||||
if e := bridgeEndpoint.FindFDBEntry(veth2.LinkAddress()); e.PortLinkAddress() != veth1.LinkAddress() {
|
||||
var e stack.BridgeFDBEntry
|
||||
start := time.Now()
|
||||
for e = bridgeEndpoint.FindFDBEntry(veth2.LinkAddress()); len(e.PortLinkAddress()) == 0 && time.Since(start) < 30*time.Second; {
|
||||
}
|
||||
if e.PortLinkAddress() != veth1.LinkAddress() {
|
||||
t.Fatalf("bridgeEndpoint.FindFDBEntry(%s) = %s, want = %s", veth2.LinkAddress(), e.PortLinkAddress(), veth1.LinkAddress())
|
||||
}
|
||||
// No FDB entry is expected for devices other than veth1.
|
||||
|
||||
Reference in New Issue
Block a user