@@ -372,64 +372,3 @@ func TestUpstreamSettingsPolicyTargetRefNameUniqueness(t *testing.T) {
372372 })
373373 }
374374}
375-
376- func TestUpstreamSettingsPolicy_LoadBalancingMethodTypes (t * testing.T ) {
377- t .Parallel ()
378- k8sClient := getKubernetesClient (t )
379-
380- convertLBType := func (s ngfAPIv1alpha1.LoadBalancingType ) * ngfAPIv1alpha1.LoadBalancingType {
381- return & s
382- }
383-
384- tests := []struct {
385- spec ngfAPIv1alpha1.UpstreamSettingsPolicySpec
386- name string
387- wantErrors []string
388- }{
389- {
390- name : "Valid LoadBalancingType 'random two least_conn' is allowed" ,
391- spec : ngfAPIv1alpha1.UpstreamSettingsPolicySpec {
392- LoadBalancingMethod : convertLBType (ngfAPIv1alpha1 .LoadBalancingTypeRandomTwoLeastConnection ),
393- },
394- },
395- {
396- name : "Valid LoadBalancingType 'ip_hash' is allowed" ,
397- spec : ngfAPIv1alpha1.UpstreamSettingsPolicySpec {
398- LoadBalancingMethod : convertLBType (ngfAPIv1alpha1 .LoadBalancingTypeIPHash ),
399- },
400- },
401- {
402- name : "Invalid LoadBalancingType 'invalid_type' is not allowed" ,
403- wantErrors : []string {
404- "spec.loadBalancingMethod: Unsupported value: " +
405- "\" invalid_type\" : supported values: \" ip_hash\" , \" random two least_conn\" " ,
406- },
407- spec : ngfAPIv1alpha1.UpstreamSettingsPolicySpec {
408- LoadBalancingMethod : convertLBType ("invalid_type" ),
409- },
410- },
411- }
412-
413- for _ , tt := range tests {
414- t .Run (tt .name , func (t * testing.T ) {
415- t .Parallel ()
416-
417- tt .spec .TargetRefs = []gatewayv1.LocalPolicyTargetReference {
418- {
419- Kind : serviceKind ,
420- Group : coreGroup ,
421- Name : gatewayv1 .ObjectName (uniqueResourceName (testTargetRefName )),
422- },
423- }
424-
425- upstreamSettingsPolicy := & ngfAPIv1alpha1.UpstreamSettingsPolicy {
426- ObjectMeta : controllerruntime.ObjectMeta {
427- Name : uniqueResourceName (testResourceName ),
428- Namespace : defaultNamespace ,
429- },
430- Spec : tt .spec ,
431- }
432- validateCrd (t , tt .wantErrors , upstreamSettingsPolicy , k8sClient )
433- })
434- }
435- }
0 commit comments