mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-21 20:08:54 +00:00
virtcontainers/tests: Disable selected tests for uid != 0
Skip a number of virtcontainers tests if not running as `root.` Fixes #70. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
@@ -279,6 +279,10 @@ func testGenerateCCProxySockDir() (string, error) {
|
||||
}
|
||||
|
||||
func TestCreatePodHyperstartAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigHyperstartAgent()
|
||||
@@ -308,6 +312,10 @@ func TestCreatePodHyperstartAgentSuccessful(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePodKataAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigKataAgent()
|
||||
@@ -383,6 +391,10 @@ func TestDeletePodNoopAgentSuccessful(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePodHyperstartAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigHyperstartAgent()
|
||||
@@ -422,6 +434,10 @@ func TestDeletePodHyperstartAgentSuccessful(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePodKataAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigKataAgent()
|
||||
@@ -527,6 +543,10 @@ func TestStartPodHyperstartAgentSuccessful(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStartPodKataAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigKataAgent()
|
||||
@@ -685,6 +705,10 @@ func TestStopPodHyperstartAgentSuccessful(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStopPodKataAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigKataAgent()
|
||||
@@ -791,6 +815,10 @@ func TestRunPodHyperstartAgentSuccessful(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRunPodKataAgentSuccessful(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
cleanUp()
|
||||
|
||||
config := newTestPodConfigKataAgent()
|
||||
|
@@ -193,6 +193,10 @@ func cleanupFakeRootfsSetup(testRawFile, loopDev, mntDir string) {
|
||||
}
|
||||
|
||||
func TestContainerAddDriveDir(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
testRawFile, loopDev, fakeRootfs, err := testSetupFakeRootfs(t)
|
||||
|
||||
defer cleanupFakeRootfsSetup(testRawFile, loopDev, fakeRootfs)
|
||||
|
@@ -309,6 +309,10 @@ func TestCreateVirtualNetworkEndpointInvalidArgs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsPhysicalIface(t *testing.T) {
|
||||
if os.Geteuid() != 0 {
|
||||
t.Skip(testDisabledAsNonRoot)
|
||||
}
|
||||
|
||||
testNetIface := "testIface0"
|
||||
testMTU := 1500
|
||||
testMACAddr := "00:00:00:00:00:01"
|
||||
|
Reference in New Issue
Block a user