Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
nsenter: skip ut on non-root
Browse files Browse the repository at this point in the history
nsenter needs root privilege to run.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
  • Loading branch information
bergwolf committed Dec 26, 2019
1 parent e5b04a5 commit 5617120
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions virtcontainers/pkg/nsenter/nsenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ import (

"github.com/stretchr/testify/assert"
"golang.org/x/sys/unix"

ktu "github.com/kata-containers/runtime/pkg/katatestutils"
)

const testPID = 12345

var tu = ktu.NewTestConstraint(true)

func TestGetNSPathFromPID(t *testing.T) {
for nsType := range CloneFlagsTable {
expectedPath := fmt.Sprintf("/proc/%d/ns/%s", testPID, nsType)
Expand Down Expand Up @@ -165,6 +169,9 @@ func TestNsEnterEmptyNamespaceListSuccess(t *testing.T) {
}

func TestNsEnterSuccessful(t *testing.T) {
if tu.NotValid(ktu.NeedRoot()) {
t.Skip(ktu.TestDisabledNeedRoot)
}
nsList := supportedNamespaces()
sleepDuration := 60

Expand Down

0 comments on commit 5617120

Please sign in to comment.