Help deflake TestTCPConfirmNeighborReachability

...by not assuming that the NUD event is available immediately after
receiving the readable signal from the TCP endpoint. The readable
signal may be triggered before the NUD event is sent.

PiperOrigin-RevId: 512120289
This commit is contained in:
Ghanan Gowripalan
2023-02-24 11:30:25 -08:00
committed by gVisor bot
parent 6e425b0c57
commit 6526c169cd
@@ -1093,15 +1093,10 @@ func (d *nudDispatcher) OnNeighborRemoved(nicID tcpip.NICID, entry stack.Neighbo
}
func (d *nudDispatcher) expectEvent(want eventInfo) error {
select {
case got := <-d.c:
if diff := cmp.Diff(want, got, cmp.AllowUnexported(eventInfo{}), cmpopts.IgnoreFields(stack.NeighborEntry{}, "UpdatedAt")); diff != "" {
return fmt.Errorf("got invalid event (-want +got):\n%s", diff)
}
return nil
default:
return fmt.Errorf("event didn't arrive")
if diff := cmp.Diff(want, <-d.c, cmp.AllowUnexported(eventInfo{}), cmpopts.IgnoreFields(stack.NeighborEntry{}, "UpdatedAt")); diff != "" {
return fmt.Errorf("got invalid event (-want +got):\n%s", diff)
}
return nil
}
// TestTCPConfirmNeighborReachability tests that TCP informs layers beneath it