Permalink
Browse files

Merge pull request #55389 from miaoyq/completet-test-case

Automatic merge from submit-queue. 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>.

Complete test case for kubeletconfig api validation

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #55664

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
  • Loading branch information...
k8s-merge-robot committed Nov 15, 2017
2 parents 28c483e + 4afddd4 commit 1ced91f2011b6d20a9572cf782762a1ca5da05c0
Showing with 4 additions and 4 deletions.
  1. +4 −4 pkg/kubelet/apis/kubeletconfig/validation/validation_test.go
@@ -26,7 +26,7 @@ import (
func TestValidateKubeletConfiguration(t *testing.T) {
successCase := &kubeletconfig.KubeletConfiguration{
CgroupsPerQOS: true,
EnforceNodeAllocatable: []string{"pods"},
EnforceNodeAllocatable: []string{"pods", "system-reserved", "kube-reserved"},
SystemCgroups: "",
CgroupRoot: "",
CAdvisorPort: 0,
@@ -54,7 +54,7 @@ func TestValidateKubeletConfiguration(t *testing.T) {
errorCase := &kubeletconfig.KubeletConfiguration{
CgroupsPerQOS: false,
EnforceNodeAllocatable: []string{"pods"},
EnforceNodeAllocatable: []string{"pods", "system-reserved", "kube-reserved", "illegal-key"},
SystemCgroups: "/",
CgroupRoot: "",
CAdvisorPort: -10,
@@ -76,7 +76,7 @@ func TestValidateKubeletConfiguration(t *testing.T) {
RegistryBurst: -10,
RegistryPullQPS: -10,
}
if allErrors := ValidateKubeletConfiguration(errorCase); len(allErrors.(utilerrors.Aggregate).Errors()) != 20 {
t.Errorf("expect 20 errors got %v", len(allErrors.(utilerrors.Aggregate).Errors()))
if allErrors := ValidateKubeletConfiguration(errorCase); len(allErrors.(utilerrors.Aggregate).Errors()) != 21 {
t.Errorf("expect 21 errors got %v", len(allErrors.(utilerrors.Aggregate).Errors()))
}
}

0 comments on commit 1ced91f

Please sign in to comment.