diff --git a/internal/k8s/validation_test.go b/internal/k8s/validation_test.go index 6f93b9e9df..b3ce974511 100644 --- a/internal/k8s/validation_test.go +++ b/internal/k8s/validation_test.go @@ -252,6 +252,48 @@ func TestValidateNginxIngressAnnotations(t *testing.T) { }, msg: "invalid nginx.org/lb-method annotation, nginx plus only", }, + { + annotations: map[string]string{ + "nginx.org/lb-method": "least_time header;", + }, + specServices: map[string]bool{}, + isPlus: true, + appProtectEnabled: false, + appProtectDosEnabled: false, + internalRoutesEnabled: false, + expectedErrors: []string{ + `annotations.nginx.org/lb-method: Invalid value: "least_time header;": Invalid load balancing method: "least_time header;"`, + }, + msg: "invalid nginx.org/lb-method annotation", + }, + { + annotations: map[string]string{ + "nginx.org/lb-method": "{least_time header}", + }, + specServices: map[string]bool{}, + isPlus: true, + appProtectEnabled: false, + appProtectDosEnabled: false, + internalRoutesEnabled: false, + expectedErrors: []string{ + `annotations.nginx.org/lb-method: Invalid value: "{least_time header}": Invalid load balancing method: "{least_time header}"`, + }, + msg: "invalid nginx.org/lb-method annotation", + }, + { + annotations: map[string]string{ + "nginx.org/lb-method": "$least_time header", + }, + specServices: map[string]bool{}, + isPlus: true, + appProtectEnabled: false, + appProtectDosEnabled: false, + internalRoutesEnabled: false, + expectedErrors: []string{ + `annotations.nginx.org/lb-method: Invalid value: "$least_time header": Invalid load balancing method: "$least_time header"`, + }, + msg: "invalid nginx.org/lb-method annotation", + }, { annotations: map[string]string{ "nginx.org/lb-method": "invalid_method",