mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-01 13:34:20 +01:00
Change io/ioutil to io/os packages because io/ioutil package is deprecated from 1.16: Discard => io.Discard NopCloser => io.NopCloser ReadAll => io.ReadAll ReadDir => os.ReadDir ReadFile => os.ReadFile TempDir => os.MkdirTemp TempFile => os.CreateTemp WriteFile => os.WriteFile Details: https://go.dev/doc/go1.16#ioutil Fixes: #3265 Signed-off-by: bin <bin@hyper.sh>
35 lines
621 B
Go
35 lines
621 B
Go
// Copyright (c) 2019 ARM Limited
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package virtcontainers
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRunningOnVMM(t *testing.T) {
|
|
assert := assert.New(t)
|
|
expectedOutput := false
|
|
|
|
f, err := os.CreateTemp("", "cpuinfo")
|
|
assert.NoError(err)
|
|
defer os.Remove(f.Name())
|
|
defer f.Close()
|
|
|
|
running, err := RunningOnVMM(f.Name())
|
|
assert.NoError(err)
|
|
assert.Equal(expectedOutput, running)
|
|
}
|
|
|
|
func TestAvailableGuestProtection(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
out, _ := availableGuestProtection()
|
|
assert.Equal(out, noneProtection)
|
|
}
|