Deprecate scheduler predicate and priority factory registration
This commit is contained in:
@@ -17,7 +17,6 @@ limitations under the License.
|
||||
package algorithmprovider
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"k8s.io/kubernetes/pkg/scheduler"
|
||||
@@ -30,47 +29,6 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func TestDefaultConfigExists(t *testing.T) {
|
||||
p, err := scheduler.GetAlgorithmProvider(schedulerapi.SchedulerDefaultProviderName)
|
||||
if err != nil {
|
||||
t.Errorf("error retrieving default provider: %v", err)
|
||||
}
|
||||
if p == nil {
|
||||
t.Error("algorithm provider config should not be nil")
|
||||
}
|
||||
if len(p.FitPredicateKeys) == 0 {
|
||||
t.Error("default algorithm provider shouldn't have 0 fit predicates")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAlgorithmProviders(t *testing.T) {
|
||||
for _, pn := range algorithmProviderNames {
|
||||
t.Run(pn, func(t *testing.T) {
|
||||
p, err := scheduler.GetAlgorithmProvider(pn)
|
||||
if err != nil {
|
||||
t.Fatalf("error retrieving provider: %v", err)
|
||||
}
|
||||
if len(p.PriorityFunctionKeys) == 0 {
|
||||
t.Errorf("algorithm provider shouldn't have 0 priority functions")
|
||||
}
|
||||
for _, pf := range p.PriorityFunctionKeys.List() {
|
||||
t.Run(fmt.Sprintf("priorityfunction/%s", pf), func(t *testing.T) {
|
||||
if !scheduler.IsPriorityFunctionRegistered(pf) {
|
||||
t.Errorf("priority function is not registered but is used in the algorithm provider")
|
||||
}
|
||||
})
|
||||
}
|
||||
for _, fp := range p.FitPredicateKeys.List() {
|
||||
t.Run(fmt.Sprintf("fitpredicate/%s", fp), func(t *testing.T) {
|
||||
if !scheduler.IsFitPredicateRegistered(fp) {
|
||||
t.Errorf("fit predicate is not registered but is used in the algorithm provider")
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyFeatureGates(t *testing.T) {
|
||||
for _, pn := range algorithmProviderNames {
|
||||
t.Run(pn, func(t *testing.T) {
|
||||
@@ -79,7 +37,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
t.Fatalf("Error retrieving provider: %v", err)
|
||||
}
|
||||
|
||||
if !p.FitPredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
if !p.PredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
t.Fatalf("Failed to find predicate: 'PodToleratesNodeTaints'")
|
||||
}
|
||||
})
|
||||
@@ -94,7 +52,7 @@ func TestApplyFeatureGates(t *testing.T) {
|
||||
t.Fatalf("Error retrieving '%s' provider: %v", pn, err)
|
||||
}
|
||||
|
||||
if !p.FitPredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
if !p.PredicateKeys.Has("PodToleratesNodeTaints") {
|
||||
t.Fatalf("Failed to find predicate: 'PodToleratesNodeTaints'")
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user