-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation for percentage-of-nodes-to-score of the scheduler config #69355
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,8 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) { | |
RetryPeriod: metav1.Duration{Duration: 5 * time.Second}, | ||
}, | ||
}, | ||
BindTimeoutSeconds: &testTimeout, | ||
BindTimeoutSeconds: &testTimeout, | ||
PercentageOfNodesToScore: 35, | ||
} | ||
|
||
HardPodAffinitySymmetricWeightGt100 := validConfig.DeepCopy() | ||
|
@@ -92,6 +93,9 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) { | |
bindTimeoutUnset := validConfig.DeepCopy() | ||
bindTimeoutUnset.BindTimeoutSeconds = nil | ||
|
||
percentageOfNodesToScore101 := validConfig.DeepCopy() | ||
percentageOfNodesToScore101.PercentageOfNodesToScore = int32(101) | ||
|
||
scenarios := map[string]struct { | ||
expectedToFail bool | ||
config *config.KubeSchedulerConfiguration | ||
|
@@ -136,6 +140,10 @@ func TestValidateKubeSchedulerConfiguration(t *testing.T) { | |
expectedToFail: true, | ||
config: bindTimeoutUnset, | ||
}, | ||
"bad-percentage-of-nodes-to-score": { | ||
expectedToFail: true, | ||
config: percentageOfNodesToScore101, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a positive test case as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The positive test case exists. It is labeled as "good" in the switch statement. The number 35 that I have added above is for the valid case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ohh sorry github UI wasn't showing as it wasn't a new change, so did not notice. Thanks. |
||
}, | ||
} | ||
|
||
for name, scenario := range scenarios { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious about 35. Was it chosen randomly :P ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Just a valid number (between 0 and 100) to test our validation.