@@ -80,7 +80,7 @@ func TestProcessBackendTLSPoliciesEmpty(t *testing.T) {
8080 t .Parallel ()
8181 g := NewWithT (t )
8282
83- processed := processBackendTLSPolicies (test .backendTLSPolicies , nil , nil , "test" , test .gateways )
83+ processed := processBackendTLSPolicies (test .backendTLSPolicies , nil , nil , test .gateways )
8484
8585 g .Expect (processed ).To (Equal (test .expected ))
8686 })
@@ -477,7 +477,7 @@ func TestValidateBackendTLSPolicy(t *testing.T) {
477477 t .Run (test .name , func (t * testing.T ) {
478478 g := NewWithT (t )
479479
480- valid , ignored , conds := validateBackendTLSPolicy (test .tlsPolicy , configMapResolver , secretMapResolver , "test" )
480+ valid , ignored , conds := validateBackendTLSPolicy (test .tlsPolicy , configMapResolver , secretMapResolver )
481481
482482 if ! test .isValid && ! test .ignored {
483483 g .Expect (conds ).To (HaveLen (1 ))
@@ -809,105 +809,6 @@ func TestAddGatewaysForBackendTLSPoliciesAncestorLimit(t *testing.T) {
809809 g .Expect (logOutput ).To (ContainSubstring ("ancestor=test/gateway1" ))
810810}
811811
812- func TestBackendTLSPolicyAncestorsFullFunc (t * testing.T ) {
813- t .Parallel ()
814-
815- getAncestorRef := func (ctlrName , parentName string ) v1alpha2.PolicyAncestorStatus {
816- return v1alpha2.PolicyAncestorStatus {
817- ControllerName : gatewayv1 .GatewayController (ctlrName ),
818- AncestorRef : gatewayv1.ParentReference {
819- Name : gatewayv1 .ObjectName (parentName ),
820- Namespace : helpers .GetPointer (gatewayv1 .Namespace ("test" )),
821- Group : helpers.GetPointer [gatewayv1.Group ](gatewayv1 .GroupName ),
822- Kind : helpers.GetPointer [gatewayv1.Kind ](kinds .Gateway ),
823- },
824- }
825- }
826-
827- tests := []struct {
828- name string
829- ctlrName string
830- ancestors []v1alpha2.PolicyAncestorStatus
831- expected bool
832- }{
833- {
834- name : "empty ancestors list" ,
835- ancestors : []v1alpha2.PolicyAncestorStatus {},
836- ctlrName : "nginx-gateway" ,
837- expected : false ,
838- },
839- {
840- name : "less than 16 ancestors" ,
841- ancestors : []v1alpha2.PolicyAncestorStatus {
842- getAncestorRef ("other-controller" , "gateway1" ),
843- getAncestorRef ("other-controller" , "gateway2" ),
844- },
845- ctlrName : "nginx-gateway" ,
846- expected : false ,
847- },
848- {
849- name : "exactly 16 ancestors, none from our controller" ,
850- ancestors : func () []v1alpha2.PolicyAncestorStatus {
851- ancestors := make ([]v1alpha2.PolicyAncestorStatus , 16 )
852- for i := range 16 {
853- ancestors [i ] = getAncestorRef ("other-controller" , "gateway" )
854- }
855- return ancestors
856- }(),
857- ctlrName : "nginx-gateway" ,
858- expected : true ,
859- },
860- {
861- name : "exactly 16 ancestors, one from our controller" ,
862- ancestors : func () []v1alpha2.PolicyAncestorStatus {
863- ancestors := make ([]v1alpha2.PolicyAncestorStatus , 16 )
864- for i := range 15 {
865- ancestors [i ] = getAncestorRef ("other-controller" , "gateway" )
866- }
867- ancestors [15 ] = getAncestorRef ("nginx-gateway" , "our-gateway" )
868- return ancestors
869- }(),
870- ctlrName : "nginx-gateway" ,
871- expected : false , // Not full because we can overwrite our own entry
872- },
873- {
874- name : "more than 16 ancestors, none from our controller" ,
875- ancestors : func () []v1alpha2.PolicyAncestorStatus {
876- ancestors := make ([]v1alpha2.PolicyAncestorStatus , 20 )
877- for i := range 20 {
878- ancestors [i ] = getAncestorRef ("other-controller" , "gateway" )
879- }
880- return ancestors
881- }(),
882- ctlrName : "nginx-gateway" ,
883- expected : true ,
884- },
885- {
886- name : "more than 16 ancestors, one from our controller" ,
887- ancestors : func () []v1alpha2.PolicyAncestorStatus {
888- ancestors := make ([]v1alpha2.PolicyAncestorStatus , 20 )
889- for i := range 19 {
890- ancestors [i ] = getAncestorRef ("other-controller" , "gateway" )
891- }
892- ancestors [19 ] = getAncestorRef ("nginx-gateway" , "our-gateway" )
893- return ancestors
894- }(),
895- ctlrName : "nginx-gateway" ,
896- expected : false , // Not full because we can overwrite our own entry
897- },
898- }
899-
900- for _ , test := range tests {
901- t .Run (test .name , func (t * testing.T ) {
902- t .Parallel ()
903- g := NewWithT (t )
904-
905- result := backendTLSPolicyAncestorsFull (test .ancestors , test .ctlrName )
906- g .Expect (result ).To (Equal (test .expected ))
907- })
908- }
909- }
910-
911812// testLogSink implements logr.LogSink for testing.
912813type testLogSink struct {
913814 buffer * bytes.Buffer
0 commit comments