mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-16 07:05:14 +00:00
Keep all the OS agnostic bits in the hypervisor.go and hypervisor_ARCH.go files. Fixes #3614 Signed-off-by: Eric Ernst <eric_ernst@apple.com> Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
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)
|
|
}
|