@@ -80,7 +80,7 @@ func TestProcessBackendTLSPoliciesEmpty(t *testing.T) {
80
80
t .Parallel ()
81
81
g := NewWithT (t )
82
82
83
- processed := processBackendTLSPolicies (test .backendTLSPolicies , nil , nil , "test" , test .gateways )
83
+ processed := processBackendTLSPolicies (test .backendTLSPolicies , nil , nil , test .gateways )
84
84
85
85
g .Expect (processed ).To (Equal (test .expected ))
86
86
})
@@ -477,7 +477,7 @@ func TestValidateBackendTLSPolicy(t *testing.T) {
477
477
t .Run (test .name , func (t * testing.T ) {
478
478
g := NewWithT (t )
479
479
480
- valid , ignored , conds := validateBackendTLSPolicy (test .tlsPolicy , configMapResolver , secretMapResolver , "test" )
480
+ valid , ignored , conds := validateBackendTLSPolicy (test .tlsPolicy , configMapResolver , secretMapResolver )
481
481
482
482
if ! test .isValid && ! test .ignored {
483
483
g .Expect (conds ).To (HaveLen (1 ))
@@ -809,105 +809,6 @@ func TestAddGatewaysForBackendTLSPoliciesAncestorLimit(t *testing.T) {
809
809
g .Expect (logOutput ).To (ContainSubstring ("ancestor=test/gateway1" ))
810
810
}
811
811
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
-
911
812
// testLogSink implements logr.LogSink for testing.
912
813
type testLogSink struct {
913
814
buffer * bytes.Buffer
0 commit comments