From c79a4b7b40668c3f7867bf256b80b6b2dc65e58e Mon Sep 17 00:00:00 2001 From: Oleg Senin Date: Fri, 21 Feb 2020 14:38:19 +0300 Subject: [PATCH] Skip NetNsId tests unless root --- netns_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netns_test.go b/netns_test.go index 37a3afb..39b6c93 100644 --- a/netns_test.go +++ b/netns_test.go @@ -16,6 +16,7 @@ import ( // then retrieves the ID. // This does not do any namespace switching. func TestNetNsIdByFd(t *testing.T) { + skipUnlessRoot(t) // create a network namespace ns, err := netns.New() CheckErrorFail(t, err) @@ -44,6 +45,7 @@ func TestNetNsIdByFd(t *testing.T) { // Does the same as TestNetNsIdByFd, but we need to change namespaces so we // actually have a pid in that namespace func TestNetNsIdByPid(t *testing.T) { + skipUnlessRoot(t) runtime.LockOSThread() // we need a constant OS thread origNs, _ := netns.Get()