10000 Add additional unit tests to confirm special characters can't be used in the lb-method annotation by shaun-nx · Pull Request #2742 · nginx/kubernetes-ingress · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions internal/k8s/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
0