@@ -37,9 +37,9 @@ func testValidTargetRefKind(t *testing.T) {
37
37
t .Helper ()
38
38
39
39
tests := []struct {
40
+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
40
41
name string
41
42
wantErrors []string
42
- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
43
43
}{
44
44
{
45
45
name : "Validate TargetRef of kind Gateway is allowed" ,
@@ -91,9 +91,9 @@ func testInvalidTargetRefKind(t *testing.T) {
91
91
t .Helper ()
92
92
93
93
tests := []struct {
94
+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
94
95
name string
95
96
wantErrors []string
96
- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
97
97
}{
98
98
{
99
99
name : "Validate Invalid TargetRef Kind is not allowed" ,
@@ -138,9 +138,9 @@ func testValidTargetRefGroup(t *testing.T) {
138
138
t .Helper ()
139
139
140
140
tests := []struct {
141
+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
141
142
name string
142
143
wantErrors []string
143
- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
144
144
}{
145
145
{
146
146
name : "Validate gateway.networking.k8s.io TargetRef Group is allowed" ,
@@ -175,9 +175,9 @@ func testInvalidTargetRefGroup(t *testing.T) {
175
175
t .Helper ()
176
176
177
177
tests := []struct {
178
+ policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
178
179
name string
179
180
wantErrors []string
180
- policySpec ngfAPIv1alpha1.ClientSettingsPolicySpec
181
181
}{
182
182
{
183
183
name : "Validate invalid.networking.k8s.io TargetRef Group is not allowed" ,
@@ -218,7 +218,10 @@ func testInvalidTargetRefGroup(t *testing.T) {
218
218
}
219
219
}
220
220
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
+ ) {
222
225
t .Helper ()
223
226
224
227
// Register API types with the runtime scheme
@@ -232,13 +235,10 @@ func validateClientSettingsPolicy(t *testing.T, clientSettingsPolicy *ngfAPIv1al
232
235
233
236
err := k8sClient .Create (context .Background (), clientSettingsPolicy )
234
237
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 )
236
240
}
237
241
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
-
242
242
if err != nil {
243
243
for _ , wantError := range wantErrors {
244
244
if ! strings .Contains (err .Error (), wantError ) {
0 commit comments