Allow system critical priority classes in API validation
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func TestValidatePriorityClass(t *testing.T) {
|
||||
spcs := scheduling.SystemPriorityClasses()
|
||||
successCases := map[string]scheduling.PriorityClass{
|
||||
"no description": {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "tier1", Namespace: ""},
|
||||
@@ -36,6 +37,12 @@ func TestValidatePriorityClass(t *testing.T) {
|
||||
GlobalDefault: false,
|
||||
Description: "Used for the highest priority pods.",
|
||||
},
|
||||
"system node critical": {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: spcs[0].Name, Namespace: ""},
|
||||
Value: spcs[0].Value,
|
||||
GlobalDefault: spcs[0].GlobalDefault,
|
||||
Description: "system priority class 0",
|
||||
},
|
||||
}
|
||||
|
||||
for k, v := range successCases {
|
||||
@@ -53,6 +60,16 @@ func TestValidatePriorityClass(t *testing.T) {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "tier&1", Namespace: ""},
|
||||
Value: 100,
|
||||
},
|
||||
"incorrect system class name": {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: spcs[0].Name, Namespace: ""},
|
||||
Value: 0,
|
||||
GlobalDefault: spcs[0].GlobalDefault,
|
||||
},
|
||||
"incorrect system class value": {
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "system-something", Namespace: ""},
|
||||
Value: spcs[0].Value,
|
||||
GlobalDefault: spcs[0].GlobalDefault,
|
||||
},
|
||||
}
|
||||
|
||||
for k, v := range errorCases {
|
||||
|
||||
Reference in New Issue
Block a user