mirror of https://github.com/vishvananda/netlink
Skip NetNsId tests unless root
This commit is contained in:
parent
5f2fc868c2
commit
c79a4b7b40
|
@ -16,6 +16,7 @@ import (
|
||||||
// then retrieves the ID.
|
// then retrieves the ID.
|
||||||
// This does not do any namespace switching.
|
// This does not do any namespace switching.
|
||||||
func TestNetNsIdByFd(t *testing.T) {
|
func TestNetNsIdByFd(t *testing.T) {
|
||||||
|
skipUnlessRoot(t)
|
||||||
// create a network namespace
|
// create a network namespace
|
||||||
ns, err := netns.New()
|
ns, err := netns.New()
|
||||||
CheckErrorFail(t, err)
|
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
|
// Does the same as TestNetNsIdByFd, but we need to change namespaces so we
|
||||||
// actually have a pid in that namespace
|
// actually have a pid in that namespace
|
||||||
func TestNetNsIdByPid(t *testing.T) {
|
func TestNetNsIdByPid(t *testing.T) {
|
||||||
|
skipUnlessRoot(t)
|
||||||
runtime.LockOSThread() // we need a constant OS thread
|
runtime.LockOSThread() // we need a constant OS thread
|
||||||
origNs, _ := netns.Get()
|
origNs, _ := netns.Get()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue