From 6c275c926213eddbdba91b091887dcdc36a3a378 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Sun, 27 Sep 2020 22:57:14 +0800 Subject: [PATCH] runtime: fix TestNewConsole UT failure It needs root. Signed-off-by: Peng Tao --- src/runtime/cli/console_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtime/cli/console_test.go b/src/runtime/cli/console_test.go index 951c9c24c0..80700ba463 100644 --- a/src/runtime/cli/console_test.go +++ b/src/runtime/cli/console_test.go @@ -10,6 +10,7 @@ import ( "os" "testing" + ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils" "github.com/stretchr/testify/assert" ) @@ -22,6 +23,9 @@ func TestConsoleFromFile(t *testing.T) { } func TestNewConsole(t *testing.T) { + if tc.NotValid(ktu.NeedRoot()) { + t.Skip(testDisabledAsNonRoot) + } assert := assert.New(t) console, err := newConsole() @@ -34,6 +38,9 @@ func TestNewConsole(t *testing.T) { } func TestIsTerminal(t *testing.T) { + if tc.NotValid(ktu.NeedRoot()) { + t.Skip(testDisabledAsNonRoot) + } assert := assert.New(t) var fd uintptr = 4