From 359b78c1c9d4df4307847defb1a4294f3c5a61ba Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Wed, 29 Apr 2020 01:18:48 -0700 Subject: [PATCH] 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 --- src/runtime/cli/kata-check_amd64_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/runtime/cli/kata-check_amd64_test.go b/src/runtime/cli/kata-check_amd64_test.go index 23f4aa028..780c32669 100644 --- a/src/runtime/cli/kata-check_amd64_test.go +++ b/src/runtime/cli/kata-check_amd64_test.go @@ -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("", "")