runtime: fix TestNewConsole UT failure

It needs root.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao 2020-09-27 22:57:14 +08:00 committed by Eric Ernst
parent 0479a4cb29
commit 6c275c9262

View File

@ -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