Skip to content

Commit 8c8f66a

Browse files
author
Kate Osborn
committed
Remove int validation
1 parent ce0a999 commit 8c8f66a

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

internal/mode/static/nginx/config/policies/upstreamsettings/validator.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,6 @@ func (v Validator) validateUpstreamKeepAlive(
105105
) field.ErrorList {
106106
var allErrs field.ErrorList
107107

108-
if keepAlive.Connections != nil && *keepAlive.Connections < 1 {
109-
path := fieldPath.Child("connections")
110-
allErrs = append(allErrs, field.Invalid(path, *keepAlive.Connections, "must be greater than or equal to 1"))
111-
}
112-
113-
if keepAlive.Requests != nil && *keepAlive.Requests < 0 {
114-
path := fieldPath.Child("requests")
115-
allErrs = append(allErrs, field.Invalid(path, *keepAlive.Requests, "must be greater than or equal to 0"))
116-
}
117-
118108
if keepAlive.Time != nil {
119109
if err := v.genericValidator.ValidateNginxDuration(string(*keepAlive.Time)); err != nil {
120110
path := fieldPath.Child("time")

internal/mode/static/nginx/config/policies/upstreamsettings/validator_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,6 @@ func TestValidator_Validate(t *testing.T) {
101101
"May be followed by 'k', 'm', or 'g', otherwise bytes are assumed')"),
102102
},
103103
},
104-
{
105-
name: "invalid keepalive connections",
106-
policy: createModifiedPolicy(func(p *ngfAPI.UpstreamSettingsPolicy) *ngfAPI.UpstreamSettingsPolicy {
107-
p.Spec.KeepAlive.Connections = helpers.GetPointer[int32](0)
108-
return p
109-
}),
110-
expConditions: []conditions.Condition{
111-
staticConds.NewPolicyInvalid("spec.keepAlive.connections: Invalid value: 0: must be greater than or equal to 1"),
112-
},
113-
},
114-
{
115-
name: "invalid keepalive requests",
116-
policy: createModifiedPolicy(func(p *ngfAPI.UpstreamSettingsPolicy) *ngfAPI.UpstreamSettingsPolicy {
117-
p.Spec.KeepAlive.Requests = helpers.GetPointer[int32](-10)
118-
return p
119-
}),
120-
expConditions: []conditions.Condition{
121-
staticConds.NewPolicyInvalid("spec.keepAlive.requests: Invalid value: -10: must be greater than or equal to 0"),
122-
},
123-
},
124104
{
125105
name: "invalid durations",
126106
policy: createModifiedPolicy(func(p *ngfAPI.UpstreamSettingsPolicy) *ngfAPI.UpstreamSettingsPolicy {

0 commit comments

Comments
 (0)