Commit 4afddd4a authored by Yanqiang Miao's avatar Yanqiang Miao

Complete test case for kubeletconfig validation

parent 3b4424ce
...@@ -26,7 +26,7 @@ import ( ...@@ -26,7 +26,7 @@ import (
func TestValidateKubeletConfiguration(t *testing.T) { func TestValidateKubeletConfiguration(t *testing.T) {
successCase := &kubeletconfig.KubeletConfiguration{ successCase := &kubeletconfig.KubeletConfiguration{
CgroupsPerQOS: true, CgroupsPerQOS: true,
EnforceNodeAllocatable: []string{"pods"}, EnforceNodeAllocatable: []string{"pods", "system-reserved", "kube-reserved"},
SystemCgroups: "", SystemCgroups: "",
CgroupRoot: "", CgroupRoot: "",
CAdvisorPort: 0, CAdvisorPort: 0,
...@@ -54,7 +54,7 @@ func TestValidateKubeletConfiguration(t *testing.T) { ...@@ -54,7 +54,7 @@ func TestValidateKubeletConfiguration(t *testing.T) {
errorCase := &kubeletconfig.KubeletConfiguration{ errorCase := &kubeletconfig.KubeletConfiguration{
CgroupsPerQOS: false, CgroupsPerQOS: false,
EnforceNodeAllocatable: []string{"pods"}, EnforceNodeAllocatable: []string{"pods", "system-reserved", "kube-reserved", "illegal-key"},
SystemCgroups: "/", SystemCgroups: "/",
CgroupRoot: "", CgroupRoot: "",
CAdvisorPort: -10, CAdvisorPort: -10,
...@@ -76,7 +76,7 @@ func TestValidateKubeletConfiguration(t *testing.T) { ...@@ -76,7 +76,7 @@ func TestValidateKubeletConfiguration(t *testing.T) {
RegistryBurst: -10, RegistryBurst: -10,
RegistryPullQPS: -10, RegistryPullQPS: -10,
} }
if allErrors := ValidateKubeletConfiguration(errorCase); len(allErrors.(utilerrors.Aggregate).Errors()) != 20 { if allErrors := ValidateKubeletConfiguration(errorCase); len(allErrors.(utilerrors.Aggregate).Errors()) != 21 {
t.Errorf("expect 20 errors got %v", len(allErrors.(utilerrors.Aggregate).Errors())) t.Errorf("expect 21 errors got %v", len(allErrors.(utilerrors.Aggregate).Errors()))
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment