KEP-3619: rename variable in TestPodAdmissionBasedOnSupplementalGroupsPolicy

This commit is contained in:
Shingo Omura 2025-03-11 20:27:57 +09:00
parent 586af6b568
commit c6d6e0414c
No known key found for this signature in database

View File

@ -437,7 +437,7 @@ func TestRejectPodAdmissionBasedOnOSField(t *testing.T) {
} }
func TestPodAdmissionBasedOnSupplementalGroupsPolicy(t *testing.T) { func TestPodAdmissionBasedOnSupplementalGroupsPolicy(t *testing.T) {
nodeSupportedTheFeature := &v1.Node{ nodeWithFeature := &v1.Node{
ObjectMeta: metav1.ObjectMeta{Name: "test"}, ObjectMeta: metav1.ObjectMeta{Name: "test"},
Status: v1.NodeStatus{ Status: v1.NodeStatus{
Features: &v1.NodeFeatures{ Features: &v1.NodeFeatures{
@ -445,11 +445,11 @@ func TestPodAdmissionBasedOnSupplementalGroupsPolicy(t *testing.T) {
}, },
}, },
} }
nodeNotSupportedTheFeature := &v1.Node{ nodeWithoutFeature := &v1.Node{
ObjectMeta: metav1.ObjectMeta{Name: "test"}, ObjectMeta: metav1.ObjectMeta{Name: "test"},
} }
podNotUsedTheFeature := &v1.Pod{} podNotUsingFeature := &v1.Pod{}
podUsedTheFeature := &v1.Pod{Spec: v1.PodSpec{ podUsingFeature := &v1.Pod{Spec: v1.PodSpec{
SecurityContext: &v1.PodSecurityContext{ SecurityContext: &v1.PodSecurityContext{
SupplementalGroupsPolicy: ptr.To(v1.SupplementalGroupsPolicyStrict), SupplementalGroupsPolicy: ptr.To(v1.SupplementalGroupsPolicyStrict),
}, },
@ -465,29 +465,29 @@ func TestPodAdmissionBasedOnSupplementalGroupsPolicy(t *testing.T) {
{ {
name: "feature=Beta, node=feature not supported, pod=in use: it should REJECT", name: "feature=Beta, node=feature not supported, pod=in use: it should REJECT",
emulationVersion: utilversion.MustParse("1.33"), emulationVersion: utilversion.MustParse("1.33"),
node: nodeNotSupportedTheFeature, node: nodeWithoutFeature,
pod: podUsedTheFeature, pod: podUsingFeature,
expectRejection: true, expectRejection: true,
}, },
{ {
name: "feature=Beta, node=feature supported, pod=in use: it should ADMIT", name: "feature=Beta, node=feature supported, pod=in use: it should ADMIT",
emulationVersion: utilversion.MustParse("1.33"), emulationVersion: utilversion.MustParse("1.33"),
node: nodeSupportedTheFeature, node: nodeWithFeature,
pod: podUsedTheFeature, pod: podUsingFeature,
expectRejection: false, expectRejection: false,
}, },
{ {
name: "feature=Beta, node=feature not supported, pod=not in use: it should ADMIT", name: "feature=Beta, node=feature not supported, pod=not in use: it should ADMIT",
emulationVersion: utilversion.MustParse("1.33"), emulationVersion: utilversion.MustParse("1.33"),
node: nodeNotSupportedTheFeature, node: nodeWithoutFeature,
pod: podNotUsedTheFeature, pod: podNotUsingFeature,
expectRejection: false, expectRejection: false,
}, },
{ {
name: "feature=Beta, node=feature supported, pod=not in use: it should ADMIT", name: "feature=Beta, node=feature supported, pod=not in use: it should ADMIT",
emulationVersion: utilversion.MustParse("1.33"), emulationVersion: utilversion.MustParse("1.33"),
node: nodeSupportedTheFeature, node: nodeWithFeature,
pod: podNotUsedTheFeature, pod: podNotUsingFeature,
expectRejection: false, expectRejection: false,
}, },
// The feature is Alpha(v1.31, v1.32) in emulated version // The feature is Alpha(v1.31, v1.32) in emulated version
@ -495,29 +495,29 @@ func TestPodAdmissionBasedOnSupplementalGroupsPolicy(t *testing.T) {
{ {
name: "feature=Alpha, node=feature not supported, pod=feature used: it should ADMIT", name: "feature=Alpha, node=feature not supported, pod=feature used: it should ADMIT",
emulationVersion: utilversion.MustParse("1.32"), emulationVersion: utilversion.MustParse("1.32"),
node: nodeNotSupportedTheFeature, node: nodeWithoutFeature,
pod: podUsedTheFeature, pod: podUsingFeature,
expectRejection: false, expectRejection: false,
}, },
{ {
name: "feature=Alpha, node=feature not supported, pod=feature not used: it should ADMIT", name: "feature=Alpha, node=feature not supported, pod=feature not used: it should ADMIT",
emulationVersion: utilversion.MustParse("1.32"), emulationVersion: utilversion.MustParse("1.32"),
node: nodeNotSupportedTheFeature, node: nodeWithoutFeature,
pod: podNotUsedTheFeature, pod: podNotUsingFeature,
expectRejection: false, expectRejection: false,
}, },
{ {
name: "feature=Alpha, node=feature supported, pod=feature used: it should ADMIT", name: "feature=Alpha, node=feature supported, pod=feature used: it should ADMIT",
emulationVersion: utilversion.MustParse("1.32"), emulationVersion: utilversion.MustParse("1.32"),
node: nodeSupportedTheFeature, node: nodeWithFeature,
pod: podUsedTheFeature, pod: podUsingFeature,
expectRejection: false, expectRejection: false,
}, },
{ {
name: "feature=Alpha, node=feature supported, pod=feature not used: it should ADMIT", name: "feature=Alpha, node=feature supported, pod=feature not used: it should ADMIT",
emulationVersion: utilversion.MustParse("1.32"), emulationVersion: utilversion.MustParse("1.32"),
node: nodeSupportedTheFeature, node: nodeWithFeature,
pod: podNotUsedTheFeature, pod: podNotUsingFeature,
expectRejection: false, expectRejection: false,
}, },
// The feature is not yet released (< v1.31) in emulated version (this can happen when only kubelet downgraded). // The feature is not yet released (< v1.31) in emulated version (this can happen when only kubelet downgraded).
@ -525,15 +525,15 @@ func TestPodAdmissionBasedOnSupplementalGroupsPolicy(t *testing.T) {
{ {
name: "feature=NotReleased, node=feature not supported, pod=feature used: it should ADMIT", name: "feature=NotReleased, node=feature not supported, pod=feature used: it should ADMIT",
emulationVersion: utilversion.MustParse("1.30"), emulationVersion: utilversion.MustParse("1.30"),
node: nodeNotSupportedTheFeature, node: nodeWithoutFeature,
pod: podUsedTheFeature, pod: podUsingFeature,
expectRejection: false, expectRejection: false,
}, },
{ {
name: "feature=NotReleased, node=feature not supported, pod=feature not used: it should ADMIT", name: "feature=NotReleased, node=feature not supported, pod=feature not used: it should ADMIT",
emulationVersion: utilversion.MustParse("1.30"), emulationVersion: utilversion.MustParse("1.30"),
node: nodeNotSupportedTheFeature, node: nodeWithoutFeature,
pod: podNotUsedTheFeature, pod: podNotUsingFeature,
expectRejection: false, expectRejection: false,
}, },
} }