mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Fixed ConcurrentNodeSyncs option validation
This commit is contained in:
parent
0816394e63
commit
197683f347
@ -55,7 +55,7 @@ func (o *NodeControllerOptions) Validate() []error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var errors []error
|
var errors []error
|
||||||
if o.ConcurrentNodeSyncs < 0 {
|
if o.ConcurrentNodeSyncs <= 0 {
|
||||||
errors = append(errors, fmt.Errorf("concurrent-node-syncs must be a positive number"))
|
errors = append(errors, fmt.Errorf("concurrent-node-syncs must be a positive number"))
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
|
@ -47,11 +47,12 @@ func TestNodeControllerConcurrentNodeSyncsValidation(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "negative value",
|
desc: "negative value",
|
||||||
input: &NodeControllerOptions{NodeControllerConfiguration: &nodeconfig.NodeControllerConfiguration{ConcurrentNodeSyncs: -5}},
|
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",
|
desc: "zero value",
|
||||||
input: &NodeControllerOptions{NodeControllerConfiguration: &nodeconfig.NodeControllerConfiguration{ConcurrentNodeSyncs: 0}},
|
input: &NodeControllerOptions{NodeControllerConfiguration: &nodeconfig.NodeControllerConfiguration{ConcurrentNodeSyncs: 0}},
|
||||||
|
expect: []error{fmt.Errorf("concurrent-node-syncs must be a positive number")},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "positive value",
|
desc: "positive value",
|
||||||
|
Loading…
Reference in New Issue
Block a user