mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 08:47:56 +00:00
tests: Update test code to use test constraints
Updated the test code to use the new test constraints feature. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
8e144e08e6
commit
23f7cfa9f4
@ -15,6 +15,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/pkg/katautils"
|
"github.com/kata-containers/runtime/pkg/katautils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
@ -70,9 +71,9 @@ func TestCreatePIDFileEmptyPathSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreatePIDFileUnableToRemove(t *testing.T) {
|
func TestCreatePIDFileUnableToRemove(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
// The os.FileMode(0000) trick doesn't work for root.
|
// The os.FileMode(0000) trick doesn't work for root.
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -387,8 +388,8 @@ func TestCreateContainerInvalid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateProcessCgroupsPathSuccessful(t *testing.T) {
|
func TestCreateProcessCgroupsPathSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -489,9 +490,9 @@ func TestCreateProcessCgroupsPathSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateCreateCgroupsFilesFail(t *testing.T) {
|
func TestCreateCreateCgroupsFilesFail(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
// The os.FileMode(0000) trick doesn't work for root.
|
// The os.FileMode(0000) trick doesn't work for root.
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -575,9 +576,9 @@ func TestCreateCreateCgroupsFilesFail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateCreateCreatePidFileFail(t *testing.T) {
|
func TestCreateCreateCreatePidFileFail(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
// The os.FileMode(0000) trick doesn't work for root.
|
// The os.FileMode(0000) trick doesn't work for root.
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -652,8 +653,8 @@ func TestCreateCreateCreatePidFileFail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreate(t *testing.T) {
|
func TestCreate(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
|
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
|
||||||
@ -597,8 +598,8 @@ func TestDeleteCLIFunctionSuccess(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRemoveCGroupsPath(t *testing.T) {
|
func TestRemoveCGroupsPath(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ func TestFactoryCLIFunctionInit(t *testing.T) {
|
|||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
|
|
||||||
// With template
|
// With template
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/pkg/katautils"
|
"github.com/kata-containers/runtime/pkg/katautils"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -553,8 +554,8 @@ func TestCheckCheckKernelModules(t *testing.T) {
|
|||||||
func TestCheckCheckKernelModulesUnreadableFile(t *testing.T) {
|
func TestCheckCheckKernelModulesUnreadableFile(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
dir, err := ioutil.TempDir("", "")
|
dir, err := ioutil.TempDir("", "")
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/dlespiau/covertool/pkg/cover"
|
"github.com/dlespiau/covertool/pkg/cover"
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/pkg/katautils"
|
"github.com/kata-containers/runtime/pkg/katautils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
@ -34,7 +35,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
testDisabledNeedNonRoot = "Test disabled as requires non-root user"
|
|
||||||
testDirMode = os.FileMode(0750)
|
testDirMode = os.FileMode(0750)
|
||||||
testFileMode = os.FileMode(0640)
|
testFileMode = os.FileMode(0640)
|
||||||
testExeFileMode = os.FileMode(0750)
|
testExeFileMode = os.FileMode(0750)
|
||||||
@ -51,6 +51,7 @@ var (
|
|||||||
// package variables set by calling TestMain()
|
// package variables set by calling TestMain()
|
||||||
testDir = ""
|
testDir = ""
|
||||||
testBundleDir = ""
|
testBundleDir = ""
|
||||||
|
tc ktu.TestConstraint
|
||||||
)
|
)
|
||||||
|
|
||||||
// testingImpl is a concrete mock RVC implementation used for testing
|
// testingImpl is a concrete mock RVC implementation used for testing
|
||||||
@ -122,6 +123,8 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("ERROR: failed to create OCI bundle: %v", err))
|
panic(fmt.Sprintf("ERROR: failed to create OCI bundle: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tc = ktu.NewTestConstraint(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// resetCLIGlobals undoes the effects of setCLIGlobals(), restoring the original values
|
// resetCLIGlobals undoes the effects of setCLIGlobals(), restoring the original values
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
|
vcAnnotations "github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
@ -223,8 +224,8 @@ func testRunContainerSetup(t *testing.T) runContainerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRunContainerSuccessful(t *testing.T) {
|
func TestRunContainerSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -332,8 +333,8 @@ func TestRunContainerSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRunContainerDetachSuccessful(t *testing.T) {
|
func TestRunContainerDetachSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -19,14 +19,15 @@ import (
|
|||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/pkg/katautils"
|
"github.com/kata-containers/runtime/pkg/katautils"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateSandboxSuccess(t *testing.T) {
|
func TestCreateSandboxSuccess(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -97,9 +98,10 @@ func TestCreateSandboxSuccess(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateSandboxFail(t *testing.T) {
|
func TestCreateSandboxFail(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
tmpdir, err := ioutil.TempDir("", "")
|
tmpdir, err := ioutil.TempDir("", "")
|
||||||
@ -142,8 +144,8 @@ func TestCreateSandboxFail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateSandboxConfigFail(t *testing.T) {
|
func TestCreateSandboxConfigFail(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/pkg/katautils"
|
"github.com/kata-containers/runtime/pkg/katautils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
@ -41,8 +42,6 @@ const (
|
|||||||
testBundle = "bundle"
|
testBundle = "bundle"
|
||||||
testConsole = "/dev/pts/888"
|
testConsole = "/dev/pts/888"
|
||||||
|
|
||||||
testDisabledNeedRoot = "Test disabled as requires root user"
|
|
||||||
|
|
||||||
testContainerTypeAnnotation = "io.kubernetes.cri.container-type"
|
testContainerTypeAnnotation = "io.kubernetes.cri.container-type"
|
||||||
testSandboxIDAnnotation = "io.kubernetes.cri.sandbox-id"
|
testSandboxIDAnnotation = "io.kubernetes.cri.sandbox-id"
|
||||||
testContainerTypeSandbox = "sandbox"
|
testContainerTypeSandbox = "sandbox"
|
||||||
@ -53,6 +52,7 @@ var (
|
|||||||
// package variables set by calling TestMain()
|
// package variables set by calling TestMain()
|
||||||
testDir = ""
|
testDir = ""
|
||||||
testBundleDir = ""
|
testBundleDir = ""
|
||||||
|
tc ktu.TestConstraint
|
||||||
)
|
)
|
||||||
|
|
||||||
// testingImpl is a concrete mock RVC implementation used for testing
|
// testingImpl is a concrete mock RVC implementation used for testing
|
||||||
@ -108,6 +108,8 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("ERROR: failed to create OCI bundle: %v", err))
|
panic(fmt.Sprintf("ERROR: failed to create OCI bundle: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tc = ktu.NewTestConstraint(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// createOCIConfig creates an OCI configuration (spec) file in
|
// createOCIConfig creates an OCI configuration (spec) file in
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -42,7 +43,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func skipUnlessRoot(t *testing.T) {
|
func skipUnlessRoot(t *testing.T) {
|
||||||
if os.Getuid() != 0 {
|
tc := ktu.NewTestConstraint(false)
|
||||||
|
|
||||||
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip("Test disabled as requires root user")
|
t.Skip("Test disabled as requires root user")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kata-containers/runtime/pkg/katatestutils"
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/utils"
|
"github.com/kata-containers/runtime/virtcontainers/utils"
|
||||||
@ -84,7 +84,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
disableNewNetNs := false
|
disableNewNetNs := false
|
||||||
|
|
||||||
configFileOptions := katatestutils.RuntimeConfigOptions{
|
configFileOptions := ktu.RuntimeConfigOptions{
|
||||||
Hypervisor: "qemu",
|
Hypervisor: "qemu",
|
||||||
HypervisorPath: hypervisorPath,
|
HypervisorPath: hypervisorPath,
|
||||||
KernelPath: kernelPath,
|
KernelPath: kernelPath,
|
||||||
@ -115,7 +115,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
AgentTrace: agentTrace,
|
AgentTrace: agentTrace,
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimeConfigFileData := katatestutils.MakeRuntimeConfigFileData(configFileOptions)
|
runtimeConfigFileData := ktu.MakeRuntimeConfigFileData(configFileOptions)
|
||||||
|
|
||||||
configPath := path.Join(dir, "runtime.toml")
|
configPath := path.Join(dir, "runtime.toml")
|
||||||
err = createConfig(configPath, runtimeConfigFileData)
|
err = createConfig(configPath, runtimeConfigFileData)
|
||||||
@ -422,8 +422,8 @@ func TestConfigLoadConfigurationFailMissingShim(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigLoadConfigurationFailUnreadableConfig(t *testing.T) {
|
func TestConfigLoadConfigurationFailUnreadableConfig(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpdir, err := ioutil.TempDir(testDir, "runtime-config-")
|
tmpdir, err := ioutil.TempDir(testDir, "runtime-config-")
|
||||||
@ -445,8 +445,8 @@ func TestConfigLoadConfigurationFailUnreadableConfig(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigLoadConfigurationFailTOMLConfigFileInvalidContents(t *testing.T) {
|
func TestConfigLoadConfigurationFailTOMLConfigFileInvalidContents(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpdir, err := ioutil.TempDir(testDir, "runtime-config-")
|
tmpdir, err := ioutil.TempDir(testDir, "runtime-config-")
|
||||||
@ -471,8 +471,8 @@ func TestConfigLoadConfigurationFailTOMLConfigFileInvalidContents(t *testing.T)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigLoadConfigurationFailTOMLConfigFileDuplicatedData(t *testing.T) {
|
func TestConfigLoadConfigurationFailTOMLConfigFileDuplicatedData(t *testing.T) {
|
||||||
if os.Geteuid() == 0 {
|
if tc.NotValid(ktu.NeedNonRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpdir, err := ioutil.TempDir(testDir, "runtime-config-")
|
tmpdir, err := ioutil.TempDir(testDir, "runtime-config-")
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/vcmock"
|
||||||
@ -38,8 +39,14 @@ var (
|
|||||||
|
|
||||||
// testingImpl is a concrete mock RVC implementation used for testing
|
// testingImpl is a concrete mock RVC implementation used for testing
|
||||||
testingImpl = &vcmock.VCMock{}
|
testingImpl = &vcmock.VCMock{}
|
||||||
|
|
||||||
|
tc ktu.TestConstraint
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
tc = ktu.NewTestConstraint(false)
|
||||||
|
}
|
||||||
|
|
||||||
// readOCIConfig returns an OCI spec.
|
// readOCIConfig returns an OCI spec.
|
||||||
func readOCIConfigFile(configPath string) (oci.CompatOCISpec, error) {
|
func readOCIConfigFile(configPath string) (oci.CompatOCISpec, error) {
|
||||||
if configPath == "" {
|
if configPath == "" {
|
||||||
@ -178,8 +185,8 @@ func findLastParam(key string, params []vc.Param) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSetEphemeralStorageType(t *testing.T) {
|
func TestSetEphemeralStorageType(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -313,8 +320,8 @@ func TestCreateSandboxConfigFail(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateSandboxFail(t *testing.T) {
|
func TestCreateSandboxFail(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
. "github.com/kata-containers/runtime/virtcontainers/pkg/mock"
|
. "github.com/kata-containers/runtime/virtcontainers/pkg/mock"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
@ -55,8 +56,8 @@ func createWrongHook() specs.Hook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRunHook(t *testing.T) {
|
func TestRunHook(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -86,8 +87,8 @@ func TestRunHook(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPreStartHooks(t *testing.T) {
|
func TestPreStartHooks(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -134,8 +135,8 @@ func TestPreStartHooks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPostStartHooks(t *testing.T) {
|
func TestPostStartHooks(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
@ -182,8 +183,8 @@ func TestPostStartHooks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPostStopHooks(t *testing.T) {
|
func TestPostStopHooks(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containernetworking/plugins/pkg/ns"
|
"github.com/containernetworking/plugins/pkg/ns"
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
@ -64,8 +65,8 @@ func TestGetNetNsFromBindMount(t *testing.T) {
|
|||||||
func TestHostNetworkingRequested(t *testing.T) {
|
func TestHostNetworkingRequested(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Network namespace same as the host
|
// Network namespace same as the host
|
||||||
@ -101,8 +102,8 @@ func TestHostNetworkingRequested(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSetupNetworkNamespace(t *testing.T) {
|
func TestSetupNetworkNamespace(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
@ -26,9 +26,6 @@ const (
|
|||||||
testDirMode = os.FileMode(0750)
|
testDirMode = os.FileMode(0750)
|
||||||
testFileMode = os.FileMode(0640)
|
testFileMode = os.FileMode(0640)
|
||||||
|
|
||||||
testDisabledNeedRoot = "Test disabled as requires root user"
|
|
||||||
testDisabledNeedNonRoot = "Test disabled as requires non-root user"
|
|
||||||
|
|
||||||
// small docker image used to create root filesystems from
|
// small docker image used to create root filesystems from
|
||||||
testDockerImage = "busybox"
|
testDockerImage = "busybox"
|
||||||
|
|
||||||
@ -38,7 +35,9 @@ const (
|
|||||||
specConfig = "config.json"
|
specConfig = "config.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testDir = ""
|
var (
|
||||||
|
testDir = ""
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/annotations"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/mock"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/mock"
|
||||||
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||||
@ -132,7 +133,7 @@ func TestCreateSandboxNoopAgentSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateSandboxKataAgentSuccessful(t *testing.T) {
|
func TestCreateSandboxKataAgentSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +213,7 @@ func TestDeleteSandboxNoopAgentSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteSandboxKataAgentSuccessful(t *testing.T) {
|
func TestDeleteSandboxKataAgentSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +288,7 @@ func TestStartSandboxNoopAgentSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStartSandboxKataAgentSuccessful(t *testing.T) {
|
func TestStartSandboxKataAgentSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +422,7 @@ func TestPauseThenResumeSandboxNoopAgentSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStopSandboxKataAgentSuccessful(t *testing.T) {
|
func TestStopSandboxKataAgentSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +492,7 @@ func TestRunSandboxNoopAgentSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRunSandboxKataAgentSuccessful(t *testing.T) {
|
func TestRunSandboxKataAgentSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1705,7 +1706,7 @@ func TestReleaseSandbox(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdateContainer(t *testing.T) {
|
func TestUpdateContainer(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1758,7 +1759,7 @@ func TestUpdateContainer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPauseResumeContainer(t *testing.T) {
|
func TestPauseResumeContainer(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1800,7 +1801,7 @@ func TestPauseResumeContainer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNetworkOperation(t *testing.T) {
|
func TestNetworkOperation(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/device/api"
|
"github.com/kata-containers/runtime/virtcontainers/device/api"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/device/config"
|
"github.com/kata-containers/runtime/virtcontainers/device/config"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
|
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
|
||||||
@ -138,7 +139,7 @@ func TestContainerRemoveDrive(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testSetupFakeRootfs(t *testing.T) (testRawFile, loopDev, mntDir string, err error) {
|
func testSetupFakeRootfs(t *testing.T) (testRawFile, loopDev, mntDir string, err error) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ func cleanupFakeRootfsSetup(testRawFile, loopDev, mntDir string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerAddDriveDir(t *testing.T) {
|
func TestContainerAddDriveDir(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -18,13 +17,21 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
testDisabledNeedRoot = "Test disabled as requires root user"
|
|
||||||
testDirMode = os.FileMode(0750)
|
testDirMode = os.FileMode(0750)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var tc ktu.TestConstraint
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
tc = ktu.NewTestConstraint(false)
|
||||||
|
}
|
||||||
|
|
||||||
func TestIsSystemMount(t *testing.T) {
|
func TestIsSystemMount(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
mnt string
|
mnt string
|
||||||
@ -70,8 +77,8 @@ func TestIsHostDevice(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsHostDeviceCreateFile(t *testing.T) {
|
func TestIsHostDeviceCreateFile(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
// Create regular file in /dev
|
// Create regular file in /dev
|
||||||
|
|
||||||
@ -196,8 +203,8 @@ func TestGetDeviceForPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetDeviceForPathBindMount(t *testing.T) {
|
func TestGetDeviceForPathBindMount(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
source := filepath.Join(testDir, "testDeviceDirSrc")
|
source := filepath.Join(testDir, "testDeviceDirSrc")
|
||||||
@ -301,8 +308,8 @@ func TestIsDockerVolume(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsEphemeralStorage(t *testing.T) {
|
func TestIsEphemeralStorage(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledNeedRoot)
|
t.Skip(ktu.TestDisabledNeedRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
dir, err := ioutil.TempDir(testDir, "foo")
|
dir, err := ioutil.TempDir(testDir, "foo")
|
||||||
|
@ -11,13 +11,14 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
vcTypes "github.com/kata-containers/runtime/virtcontainers/pkg/types"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/vishvananda/netlink"
|
"github.com/vishvananda/netlink"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateDeleteNetNS(t *testing.T) {
|
func TestCreateDeleteNetNS(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +176,7 @@ func TestGenerateRandomPrivateMacAdd(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateGetBridgeLink(t *testing.T) {
|
func TestCreateGetBridgeLink(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +200,7 @@ func TestCreateGetBridgeLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateGetTunTapLink(t *testing.T) {
|
func TestCreateGetTunTapLink(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +225,7 @@ func TestCreateGetTunTapLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateMacVtap(t *testing.T) {
|
func TestCreateMacVtap(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +269,7 @@ func TestCreateMacVtap(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTcRedirectNetwork(t *testing.T) {
|
func TestTcRedirectNetwork(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ package virtcontainers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containernetworking/plugins/pkg/ns"
|
"github.com/containernetworking/plugins/pkg/ns"
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/vishvananda/netlink"
|
"github.com/vishvananda/netlink"
|
||||||
"github.com/vishvananda/netns"
|
"github.com/vishvananda/netns"
|
||||||
@ -43,7 +43,7 @@ func TestPhysicalEndpoint_HotDetach(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsPhysicalIface(t *testing.T) {
|
func TestIsPhysicalIface(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
ktu "github.com/kata-containers/runtime/pkg/katatestutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBindMountInvalidSourceSymlink(t *testing.T) {
|
func TestBindMountInvalidSourceSymlink(t *testing.T) {
|
||||||
@ -47,7 +49,7 @@ func TestBindMountFailingMount(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBindMountSuccessful(t *testing.T) {
|
func TestBindMountSuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +78,7 @@ func TestBindMountSuccessful(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBindMountReadonlySuccessful(t *testing.T) {
|
func TestBindMountReadonlySuccessful(t *testing.T) {
|
||||||
if os.Geteuid() != 0 {
|
if tc.NotValid(ktu.NeedRoot()) {
|
||||||
t.Skip(testDisabledAsNonRoot)
|
t.Skip(testDisabledAsNonRoot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user