From 6526c169cdec67716bb3c9f472dd71c61a9f2e55 Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Fri, 24 Feb 2023 11:28:13 -0800 Subject: [PATCH] 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 --- pkg/tcpip/tests/integration/link_resolution_test.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/tcpip/tests/integration/link_resolution_test.go b/pkg/tcpip/tests/integration/link_resolution_test.go index 9e87834cd..bd95dd188 100644 --- a/pkg/tcpip/tests/integration/link_resolution_test.go +++ b/pkg/tcpip/tests/integration/link_resolution_test.go @@ -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