mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 17:11:29 +02:00
Fail instead of skipping when the IPv4 sender socket cannot be created
This commit is contained in:
@@ -26,16 +26,22 @@ func TestSenderRawSocketsCarryNoFwmark(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
prepare func() (net.PacketConn, error)
|
||||
// the proxy treats the IPv6 socket as optional, so a host without IPv6
|
||||
// is a reason to skip rather than to fail
|
||||
optional bool
|
||||
}{
|
||||
{"IPv4", PrepareSenderRawSocketIPv4},
|
||||
{"IPv6", PrepareSenderRawSocketIPv6},
|
||||
{name: "IPv4", prepare: PrepareSenderRawSocketIPv4},
|
||||
{name: "IPv6", prepare: PrepareSenderRawSocketIPv6, optional: true},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
conn, err := tc.prepare()
|
||||
if err != nil {
|
||||
t.Skipf("prepare raw socket: %v", err)
|
||||
if tc.optional {
|
||||
t.Skipf("prepare raw socket: %v", err)
|
||||
}
|
||||
t.Fatalf("prepare raw socket: %v", err)
|
||||
}
|
||||
defer func() {
|
||||
if err := conn.Close(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user