Skip to content

backport: ci: add delay after link creation for test add remove static arp (#2968) #3556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release/v1.5
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions netlink/netlink_test.go
Original file line number Diff line number Diff line change
@@ -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)
Copy link
Contributor

@MikeZappa87 MikeZappa87 Apr 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we waiting for a specific state here? We should avoid this type of behavior and explicitly wait for a state of the netdev and timeout if the expected state is never seen.

The problem with this is it can result in flakes depending on several factors. Let’s be deterministic with this instead.


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)