@@ -37,9 +37,9 @@ func testValidTargetRefKind(t *testing.T) {
3737 t .Helper ()
3838
3939 tests := []struct {
40+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
4041 name string
4142 wantErrors []string
42- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
4343 }{
4444 {
4545 name : "Validate TargetRef of kind Gateway is allowed" ,
@@ -91,9 +91,9 @@ func testInvalidTargetRefKind(t *testing.T) {
9191 t .Helper ()
9292
9393 tests := []struct {
94+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
9495 name string
9596 wantErrors []string
96- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
9797 }{
9898 {
9999 name : "Validate Invalid TargetRef Kind is not allowed" ,
@@ -138,9 +138,9 @@ func testValidTargetRefGroup(t *testing.T) {
138138 t .Helper ()
139139
140140 tests := []struct {
141+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
141142 name string
142143 wantErrors []string
143- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
144144 }{
145145 {
146146 name : "Validate gateway.networking.k8s.io TargetRef Group is allowed" ,
@@ -175,9 +175,9 @@ func testInvalidTargetRefGroup(t *testing.T) {
175175 t .Helper ()
176176
177177 tests := []struct {
178+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
178179 name string
179180 wantErrors []string
180- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
181181 }{
182182 {
183183 name : "Validate invalid.networking.k8s.io TargetRef Group is not allowed" ,
@@ -218,7 +218,10 @@ func testInvalidTargetRefGroup(t *testing.T) {
218218 }
219219}
220220
221- func validateClientSettingsPolicy (t * testing.T , clientSettingsPolicy * ngfAPIv1alpha1.ClientSettingsPolicy , wantErrors []string ) {
221+ func validateClientSettingsPolicy (t * testing.T ,
222+ clientSettingsPolicy * ngfAPIv1alpha1.ClientSettingsPolicy ,
223+ wantErrors []string ,
224+ ) {
222225 t .Helper ()
223226
224227 // Register API types with the runtime scheme
@@ -232,13 +235,10 @@ func validateClientSettingsPolicy(t *testing.T, clientSettingsPolicy *ngfAPIv1al
232235
233236 err := k8sClient .Create (context .Background (), clientSettingsPolicy )
234237 if err != nil {
235- t .Logf ("Error creating ClientSettingsPolicy %q: %v" , fmt .Sprintf ("%v/%v" , clientSettingsPolicy .Namespace , clientSettingsPolicy .Name ), err )
238+ t .Logf ("Error creating ClientSettingsPolicy %q: %v" ,
239+ fmt .Sprintf ("%v/%v" , clientSettingsPolicy .Namespace , clientSettingsPolicy .Name ), err )
236240 }
237241
238- // if (len(wantErrors) != 0) != (err != nil) {
239- // t.Fatalf("Unexpected response while creating ClientSettingsPolicy %q; got err=\n%v\n;want error=%v", fmt.Sprintf("%v/%v", clientSettingsPolicy.Namespace, clientSettingsPolicy.Name), err, wantErrors)
240- // }
241-
242242 if err != nil {
243243 for _ , wantError := range wantErrors {
244244 if ! strings .Contains (err .Error (), wantError ) {
0 commit comments