Commit 68d019aa authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge branch 'selftests-net-use-slowwait-to-make-sure-setup-finished'

Hangbin Liu says:

====================
selftests: net: use slowwait to make sure setup finished

The two updated tests sometimes failed because the network setup hadn't
completed. Used slowwait to ensure the setup finished and the tests
always passed. I ran both tests 50 times, and all of them passed.
====================

Link: https://patch.msgid.link/20250617105101.433718-1-liuhangbin@gmail.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents cf11cf12 94867036
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -146,18 +146,17 @@ run_cmd()
}

check_hv_connectivity() {
	ip netns exec $hv_1 ping -c 1 -W 1 $1 &>/dev/null
	sleep 1
	ip netns exec $hv_1 ping -c 1 -W 1 $2 &>/dev/null
	slowwait 5 ip netns exec $hv_1 ping -c 1 -W 1 $1 &>/dev/null
	slowwait 5 ip netns exec $hv_1 ping -c 1 -W 1 $2 &>/dev/null

	return $?
}

check_vm_connectivity() {
	run_cmd "ip netns exec $vm_11 ping -c 1 -W 1 10.0.10.12"
	slowwait 5 run_cmd "ip netns exec $vm_11 ping -c 1 -W 1 10.0.10.12"
	log_test $? 0 "VM connectivity over $1 (ipv4 default rdst)"

	run_cmd "ip netns exec $vm_21 ping -c 1 -W 1 10.0.10.22"
	slowwait 5 run_cmd "ip netns exec $vm_21 ping -c 1 -W 1 10.0.10.22"
	log_test $? 0 "VM connectivity over $1 (ipv6 default rdst)"
}

+2 −2
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ setup_sym()


	# Wait for ip config to settle
	sleep 2
	slowwait 5 ip netns exec $h1 "${ping6}" -c1 -w1 ${H2_N2_IP6} >/dev/null 2>&1
}

setup_asym()
@@ -370,7 +370,7 @@ setup_asym()
	ip -netns $r2 -6 addr add dev eth1 ${R2_N2_IP6}/64 nodad

	# Wait for ip config to settle
	sleep 2
	slowwait 5 ip netns exec $h1 "${ping6}" -c1 -w1 ${H2_N2_IP6} >/dev/null 2>&1
}

check_connectivity()