Fixed ConcurrentNodeSyncs option validation

This commit is contained in:
Paweł Banaszewski 2022-10-25 13:19:37 +00:00
parent 0816394e63
commit 197683f347
2 changed files with 5 additions and 4 deletions

View File

@ -55,7 +55,7 @@ func (o *NodeControllerOptions) Validate() []error {
return nil
}
var errors []error
if o.ConcurrentNodeSyncs < 0 {
if o.ConcurrentNodeSyncs <= 0 {
errors = append(errors, fmt.Errorf("concurrent-node-syncs must be a positive number"))
}
return errors

View File

@ -47,11 +47,12 @@ func TestNodeControllerConcurrentNodeSyncsValidation(t *testing.T) {
{
desc: "negative value",
input: &NodeControllerOptions{NodeControllerConfiguration: &nodeconfig.NodeControllerConfiguration{ConcurrentNodeSyncs: -5}},
expect: []error{fmt.Errorf("node-controller-concurrent-node-syncs must be a positive number")},
expect: []error{fmt.Errorf("concurrent-node-syncs must be a positive number")},
},
{
desc: "non negative value",
input: &NodeControllerOptions{NodeControllerConfiguration: &nodeconfig.NodeControllerConfiguration{ConcurrentNodeSyncs: 0}},
desc: "zero value",
input: &NodeControllerOptions{NodeControllerConfiguration: &nodeconfig.NodeControllerConfiguration{ConcurrentNodeSyncs: 0}},
expect: []error{fmt.Errorf("concurrent-node-syncs must be a positive number")},
},
{
desc: "positive value",