Revert "Introduce topology into the runtimeClass API"

This commit is contained in:
Yassine TIJANI
2019-05-31 20:49:40 +00:00
committed by GitHub
parent b7fa33ec15
commit 480d5e47b6
27 changed files with 76 additions and 1341 deletions

View File

@@ -20,7 +20,6 @@ import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/node"
"github.com/stretchr/testify/assert"
@@ -127,70 +126,3 @@ func TestValidateRuntimeUpdate(t *testing.T) {
})
}
}
func TestValidateScheduling(t *testing.T) {
tests := []struct {
name string
scheduling *node.Scheduling
expectErrs int
}{{
name: "valid scheduling",
scheduling: &node.Scheduling{
NodeSelector: map[string]string{"valid": "yes"},
Tolerations: []core.Toleration{{
Key: "valid",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
}},
},
}, {
name: "empty scheduling",
scheduling: &node.Scheduling{},
}, {
name: "invalid nodeSelector",
scheduling: &node.Scheduling{
NodeSelector: map[string]string{"not a valid key!!!": "nope"},
},
expectErrs: 1,
}, {
name: "invalid toleration",
scheduling: &node.Scheduling{
Tolerations: []core.Toleration{{
Key: "valid",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
}, {
Key: "not a valid key!!!",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
}},
},
expectErrs: 1,
}, {
name: "invalid scheduling",
scheduling: &node.Scheduling{
NodeSelector: map[string]string{"not a valid key!!!": "nope"},
Tolerations: []core.Toleration{{
Key: "valid",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
}, {
Key: "not a valid toleration key!!!",
Operator: core.TolerationOpExists,
Effect: core.TaintEffectNoSchedule,
}},
},
expectErrs: 2,
}}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
rc := &node.RuntimeClass{
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
Handler: "bar",
Scheduling: test.scheduling,
}
assert.Len(t, ValidateRuntimeClass(rc), test.expectErrs)
})
}
}