@@ -252,6 +252,48 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
252
252
},
253
253
msg : "invalid nginx.org/lb-method annotation, nginx plus only" ,
254
254
},
255
+ {
256
+ annotations : map [string ]string {
257
+ "nginx.org/lb-method" : "least_time header;" ,
258
+ },
259
+ specServices : map [string ]bool {},
260
+ isPlus : true ,
261
+ appProtectEnabled : false ,
262
+ appProtectDosEnabled : false ,
263
+ internalRoutesEnabled : false ,
264
+ expectedErrors : []string {
265
+ `annotations.nginx.org/lb-method: Invalid value: "least_time header;": Invalid load balancing method: "least_time header;"` ,
266
+ },
267
+ msg : "invalid nginx.org/lb-method annotation" ,
268
+ },
269
+ {
270
+ annotations : map [string ]string {
271
+ "nginx.org/lb-method" : "{least_time header}" ,
272
+ },
273
+ specServices : map [string ]bool {},
274
+ isPlus : true ,
275
+ appProtectEnabled : false ,
276
+ appProtectDosEnabled : false ,
277
+ internalRoutesEnabled : false ,
278
+ expectedErrors : []string {
279
+ `annotations.nginx.org/lb-method: Invalid value: "{least_time header}": Invalid load balancing method: "{least_time header}"` ,
280
+ },
281
+ msg : "invalid nginx.org/lb-method annotation" ,
282
+ },
283
+ {
284
+ annotations : map [string ]string {
285
+ "nginx.org/lb-method" : "$least_time header" ,
286
+ },
287
+ specServices : map [string ]bool {},
288
+ isPlus : true ,
289
+ appProtectEnabled : false ,
290
+ appProtectDosEnabled : false ,
291
+ internalRoutesEnabled : false ,
292
+ expectedErrors : []string {
293
+ `annotations.nginx.org/lb-method: Invalid value: "$least_time header": Invalid load balancing method: "$least_time header"` ,
294
+ },
295
+ msg : "invalid nginx.org/lb-method annotation" ,
296
+ },
255
297
{
256
298
annotations : map [string ]string {
257
299
"nginx.org/lb-method" : "invalid_method" ,
0 commit comments