diff --git a/netlink/netlink_test.go b/netlink/netlink_test.go index d5586f093..28f9997b4 100644 --- a/netlink/netlink_test.go +++ b/netlink/netlink_test.go @@ -9,6 +9,7 @@ package netlink import ( "net" "testing" + "time" "github.com/stretchr/testify/require" "golang.org/x/sys/unix" @@ -285,6 +286,10 @@ func TestAddRemoveStaticArp(t *testing.T) { mac, _ := net.ParseMAC("aa:b3:4d:5e:e2:4a") nl := NewNetlink() + // wait for interface to fully come up + // if it isn't fully up it might wipe the arp entry we're about to add + time.Sleep(time.Millisecond * 100) + linkInfo := LinkInfo{ Name: ifName, IPAddr: ip, @@ -302,6 +307,9 @@ func TestAddRemoveStaticArp(t *testing.T) { MacAddress: mac, } + // ensure arp address remains for a period of time + time.Sleep(time.Millisecond * 100) + err = nl.SetOrRemoveLinkAddress(linkInfo, REMOVE, NUD_INCOMPLETE) if err != nil { t.Errorf("ret val %v", err)