mirror of
https://github.com/vishvananda/netlink.git
synced 2025-09-26 11:51:11 +08:00
Skip TestSocketXDPGetInfo on EPERM
Skip TestSocketXDPGetInfo rather than failing it when the user lacks permissions to create AF_XDP sockets. This allows to run the full test suite as an unprivileged user again.
This commit is contained in:

committed by
Alessandro Boch

parent
20a4b9a571
commit
efd156c058
@@ -4,6 +4,7 @@
|
||||
package netlink
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -13,6 +14,9 @@ import (
|
||||
func TestSocketXDPGetInfo(t *testing.T) {
|
||||
xdpsockfd, err := unix.Socket(unix.AF_XDP, unix.SOCK_RAW, 0)
|
||||
if err != nil {
|
||||
if errors.Is(err, unix.EPERM) {
|
||||
t.Skipf("creating AF_XDP socket not permitted")
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer unix.Close(xdpsockfd)
|
||||
|
Reference in New Issue
Block a user