runtime: fix cli non-root ci

It turns out kata check needs root privilege to
call modprobe otherwise it fails.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao 2020-04-29 01:18:48 -07:00
parent a5589196ce
commit 359b78c1c9

View File

@ -14,6 +14,7 @@ import (
"regexp"
"testing"
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
)
@ -44,6 +45,10 @@ func setupCheckHostIsVMContainerCapable(assert *assert.Assertions, cpuInfoFile s
}
func TestCCCheckCLIFunction(t *testing.T) {
if tc.NotValid(ktu.NeedRoot()) {
t.Skip(testDisabledAsNonRoot)
}
var cpuData []testCPUData
var moduleData []testModuleData
@ -245,6 +250,10 @@ func TestCheckCheckKernelModulesNoUnrestrictedGuest(t *testing.T) {
}
func TestCheckHostIsVMContainerCapable(t *testing.T) {
if tc.NotValid(ktu.NeedRoot()) {
t.Skip(testDisabledAsNonRoot)
}
assert := assert.New(t)
dir, err := ioutil.TempDir("", "")