@@ -939,16 +939,16 @@ func TestAdmitWithPrioritizedSCC(t *testing.T) {
939
939
940
940
// create the admission plugin
941
941
plugin := NewTestAdmission (cache , tc )
942
- // match the restricted SCC
943
- testSCCAdmission (goodPod (), plugin , restricted .Name , t )
944
- // match matchingPrioritySCCOne by setting RunAsUser to 5
942
+
943
+ testSCCAdmission (goodPod (), plugin , restricted .Name , "match the restricted SCC" , t )
944
+
945
945
matchingPrioritySCCOnePod := goodPod ()
946
946
matchingPrioritySCCOnePod .Spec .Containers [0 ].SecurityContext .RunAsUser = & uidFive
947
- testSCCAdmission (matchingPrioritySCCOnePod , plugin , matchingPrioritySCCOne .Name , t )
948
- // match matchingPriorityAndScoreSCCOne by setting RunAsUser to 6
947
+ testSCCAdmission (matchingPrioritySCCOnePod , plugin , matchingPrioritySCCOne .Name , "match matchingPrioritySCCOne by setting RunAsUser to 5" , t )
948
+
949
949
matchingPriorityAndScoreSCCOnePod := goodPod ()
950
950
matchingPriorityAndScoreSCCOnePod .Spec .Containers [0 ].SecurityContext .RunAsUser = & uidSix
951
- testSCCAdmission (matchingPriorityAndScoreSCCOnePod , plugin , matchingPriorityAndScoreSCCOne .Name , t )
951
+ testSCCAdmission (matchingPriorityAndScoreSCCOnePod , plugin , matchingPriorityAndScoreSCCOne .Name , "match matchingPriorityAndScoreSCCOne by setting RunAsUser to 6" , t )
952
952
}
953
953
954
954
func TestAdmitSeccomp (t * testing.T ) {
@@ -1064,21 +1064,21 @@ func TestAdmitSeccomp(t *testing.T) {
1064
1064
1065
1065
// testSCCAdmission is a helper to admit the pod and ensure it was validated against the expected
1066
1066
// SCC.
1067
- func testSCCAdmission (pod * kapi.Pod , plugin kadmission.Interface , expectedSCC string , t * testing.T ) {
1067
+ func testSCCAdmission (pod * kapi.Pod , plugin kadmission.Interface , expectedSCC , testName string , t * testing.T ) {
1068
1068
attrs := kadmission .NewAttributesRecord (pod , nil , kapi .Kind ("Pod" ).WithVersion ("version" ), pod .Namespace , pod .Name , kapi .Resource ("pods" ).WithVersion ("version" ), "" , kadmission .Create , & user.DefaultInfo {})
1069
1069
err := plugin .Admit (attrs )
1070
1070
if err != nil {
1071
- t .Errorf ("error admitting pod: %v" , err )
1071
+ t .Errorf ("%s error admitting pod: %v" , testName , err )
1072
1072
return
1073
1073
}
1074
1074
1075
1075
validatedSCC , ok := pod .Annotations [allocator .ValidatedSCCAnnotation ]
1076
1076
if ! ok {
1077
- t .Errorf ("expected to find the validated annotation on the pod for the scc but found none" )
1077
+ t .Errorf ("expected %q to find the validated annotation on the pod for the scc but found none" , testName )
1078
1078
return
1079
1079
}
1080
1080
if validatedSCC != expectedSCC {
1081
- t .Errorf ("should have validated against %s but found %s" , expectedSCC , validatedSCC )
1081
+ t .Errorf ("%q should have validated against %s but found %s" , testName , expectedSCC , validatedSCC )
1082
1082
}
1083
1083
}
1084
1084
0 commit comments