ci: compare source tuple instead of only port (#10680)

This test is currently flaky on main because it may happen that we first
roam from our IPv4 address to the IPv6 one. Therefore, to make the
assertion pass we need to check that all flows have a different source
tuple and not just a different source port.
This commit is contained in:
Thomas Eizinger
2025-10-23 06:14:00 +11:00
committed by GitHub
parent 9ab599a065
commit d734ee0d21

View File

@@ -54,13 +54,14 @@ for flow in "${flows[@]}"; do
assert_eq "$(get_flow_field "$flow" "inner_dst_ip")" "172.21.0.101"
done
# Verify different outer_src_port after roaming (network change)
# Verify different source tuple after roaming (network change)
# The docker-compose setup uses routers and therefore the source IP is always the router.
# But conntrack on the router will allocate a new source port because the binding on the old one is still active after roaming.
original_src_port=$(get_flow_field "${flows[0]}" "outer_src_port")
# To handle roaming between IPv4 and IPv6, we need to compare the entire tuple.
original_src_tuple="$(get_flow_field "${flows[0]}" "outer_src_ip") $(get_flow_field "${flows[0]}" "outer_src_port")"
for ((i = 1; i < ${#flows[@]}; i++)); do
next_src_port=$(get_flow_field "${flows[i]}" "outer_src_port")
next_src_tuple="$(get_flow_field "${flows[i]}" "outer_src_ip") $(get_flow_field "${flows[i]}" "outer_src_port")"
assert_ne "$original_src_port" "$next_src_port"
assert_ne "$original_src_tuple" "$next_src_tuple"
done