mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 22:53:43 +00:00
nsenter: skip ut on non-root
nsenter needs root privilege to run. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
e5b04a5bf2
commit
5617120649
@ -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)
|
||||
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user