Skip tests which require a certain level of privilege

Forwarded: not-needed
Last-Updated: 2021-05-20

During build we cannot bindmount sysfs and cgroupfs in a chroot which leads to
failures.

Gbp-Pq: Name skip-tests-with-privilege.patch
This commit is contained in:
Lucas Kanashiro 2022-12-30 14:25:29 +08:00 committed by luoyaoming
parent ea97bc9e8a
commit aa91c1c8eb
3 changed files with 17 additions and 0 deletions

View File

@ -187,6 +187,7 @@ func getCreateContainerTestData() (*runtime.ContainerConfig, *runtime.PodSandbox
} }
func TestContainerCapabilities(t *testing.T) { func TestContainerCapabilities(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -267,6 +268,7 @@ func TestContainerCapabilities(t *testing.T) {
} }
func TestContainerSpecTty(t *testing.T) { func TestContainerSpecTty(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -289,6 +291,7 @@ func TestContainerSpecTty(t *testing.T) {
} }
func TestContainerSpecDefaultPath(t *testing.T) { func TestContainerSpecDefaultPath(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -311,6 +314,7 @@ func TestContainerSpecDefaultPath(t *testing.T) {
} }
func TestContainerSpecReadonlyRootfs(t *testing.T) { func TestContainerSpecReadonlyRootfs(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -328,6 +332,7 @@ func TestContainerSpecReadonlyRootfs(t *testing.T) {
} }
func TestContainerSpecWithExtraMounts(t *testing.T) { func TestContainerSpecWithExtraMounts(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -389,6 +394,7 @@ func TestContainerSpecWithExtraMounts(t *testing.T) {
} }
func TestContainerAndSandboxPrivileged(t *testing.T) { func TestContainerAndSandboxPrivileged(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -602,6 +608,7 @@ func TestContainerMounts(t *testing.T) {
} }
func TestPrivilegedBindMount(t *testing.T) { func TestPrivilegedBindMount(t *testing.T) {
t.Skip("It requires privilege to mount sysfs and cgroupfs. Not achievable during the build.")
testPid := uint32(1234) testPid := uint32(1234)
c := newTestCRIService() c := newTestCRIService()
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
@ -752,6 +759,7 @@ func TestMountPropagation(t *testing.T) {
} }
func TestPidNamespace(t *testing.T) { func TestPidNamespace(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testPid := uint32(1234) testPid := uint32(1234)
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
@ -793,6 +801,7 @@ func TestPidNamespace(t *testing.T) {
} }
func TestNoDefaultRunMount(t *testing.T) { func TestNoDefaultRunMount(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testPid := uint32(1234) testPid := uint32(1234)
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
@ -1097,6 +1106,7 @@ func TestGenerateApparmorSpecOpts(t *testing.T) {
} }
func TestMaskedAndReadonlyPaths(t *testing.T) { func TestMaskedAndReadonlyPaths(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -1185,6 +1195,7 @@ func TestMaskedAndReadonlyPaths(t *testing.T) {
} }
func TestHostname(t *testing.T) { func TestHostname(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
testContainerName := "container-name" testContainerName := "container-name"
@ -1316,6 +1327,7 @@ func TestGenerateUserString(t *testing.T) {
} }
func TestPrivilegedDevices(t *testing.T) { func TestPrivilegedDevices(t *testing.T) {
t.Skip("It requires privilege to test devices. Not achievable during the build.")
testPid := uint32(1234) testPid := uint32(1234)
c := newTestCRIService() c := newTestCRIService()
testSandboxID := "sandbox-id" testSandboxID := "sandbox-id"
@ -1378,6 +1390,7 @@ func TestPrivilegedDevices(t *testing.T) {
} }
func TestBaseOCISpec(t *testing.T) { func TestBaseOCISpec(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
c := newTestCRIService() c := newTestCRIService()
baseLimit := int64(100) baseLimit := int64(100)
c.baseOCISpecs = map[string]*oci.Spec{ c.baseOCISpecs = map[string]*oci.Spec{

View File

@ -56,6 +56,7 @@ func checkMount(t *testing.T, mounts []runtimespec.Mount, src, dest, typ string,
const testImageName = "container-image-name" const testImageName = "container-image-name"
func TestGeneralContainerSpec(t *testing.T) { func TestGeneralContainerSpec(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
testID := "test-id" testID := "test-id"
testPid := uint32(1234) testPid := uint32(1234)
containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData() containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData()
@ -69,6 +70,7 @@ func TestGeneralContainerSpec(t *testing.T) {
} }
func TestPodAnnotationPassthroughContainerSpec(t *testing.T) { func TestPodAnnotationPassthroughContainerSpec(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
if goruntime.GOOS == "darwin" { if goruntime.GOOS == "darwin" {
t.Skip("not implemented on Darwin") t.Skip("not implemented on Darwin")
} }
@ -277,6 +279,7 @@ func TestVolumeMounts(t *testing.T) {
} }
func TestContainerAnnotationPassthroughContainerSpec(t *testing.T) { func TestContainerAnnotationPassthroughContainerSpec(t *testing.T) {
t.Skip("It requires HugeTLB controller enabled which requires mounting cgroupfs. Not achievable during the build.")
if goruntime.GOOS == "darwin" { if goruntime.GOOS == "darwin" {
t.Skip("not implemented on Darwin") t.Skip("not implemented on Darwin")
} }

View File

@ -27,6 +27,7 @@ import (
) )
func TestUpdateOCILinuxResource(t *testing.T) { func TestUpdateOCILinuxResource(t *testing.T) {
t.Skip("It requires some privileges not achievable during the build.")
oomscoreadj := new(int) oomscoreadj := new(int)
*oomscoreadj = -500 *oomscoreadj = -500
for desc, test := range map[string]struct { for desc, test := range map[string]struct {