mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-02 19:49:13 +00:00
Merge pull request #63666 from xchapter7x/pkg-scheduler-factory
Automatic merge from submit-queue (batch tested with PRs 58487, 63666). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. use subtest for table units (pkg/scheduler/factory) **What this PR does / why we need it**: Update scheduler's unit table tests to use subtest **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: **Special notes for your reviewer**: breaks up PR: https://github.com/kubernetes/kubernetes/pull/63281 /ref #63267 **Release note**: ```release-note This PR will leverage subtests on the existing table tests for the scheduler units. Some refactoring of error/status messages and functions to align with new approach. ```
This commit is contained in:
@@ -36,14 +36,18 @@ func TestAlgorithmNameValidation(t *testing.T) {
|
||||
"Some,Alg:orithm",
|
||||
}
|
||||
for _, name := range algorithmNamesShouldValidate {
|
||||
if !validName.MatchString(name) {
|
||||
t.Errorf("%v should be a valid algorithm name but is not valid.", name)
|
||||
}
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if !validName.MatchString(name) {
|
||||
t.Errorf("should be a valid algorithm name but is not valid.")
|
||||
}
|
||||
})
|
||||
}
|
||||
for _, name := range algorithmNamesShouldNotValidate {
|
||||
if validName.MatchString(name) {
|
||||
t.Errorf("%v should be an invalid algorithm name but is valid.", name)
|
||||
}
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if validName.MatchString(name) {
|
||||
t.Errorf("should be an invalid algorithm name but is valid.")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,16 +74,18 @@ func TestValidatePriorityConfigOverFlow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
err := validateSelectedConfigs(test.configs)
|
||||
if test.expected {
|
||||
if err == nil {
|
||||
t.Errorf("Expected Overflow for %s", test.description)
|
||||
t.Run(test.description, func(t *testing.T) {
|
||||
err := validateSelectedConfigs(test.configs)
|
||||
if test.expected {
|
||||
if err == nil {
|
||||
t.Errorf("Expected Overflow")
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
t.Errorf("Did not expect an overflow")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
t.Errorf("Did not expect an overflow for %s", test.description)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user