"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/quota/v1/resources_test.go" between
kubernetes-1.18.14.tar.gz and kubernetes-1.18.15.tar.gz

About: Kubernetes is a platform for automating deployment, scaling, and operations of application containers across clusters of hosts (written in "Go"). 1.18.x series.

resources_test.go  (kubernetes-1.18.14):resources_test.go  (kubernetes-1.18.15)
skipping to change at line 290 skipping to change at line 290
expected: false, expected: false,
}, },
} }
for testName, testCase := range testCases { for testName, testCase := range testCases {
if result := IsZero(testCase.a); result != testCase.expected { if result := IsZero(testCase.a); result != testCase.expected {
t.Errorf("%s expected: %v, actual: %v", testName, testCas e.expected, result) t.Errorf("%s expected: %v, actual: %v", testName, testCas e.expected, result)
} }
} }
} }
func TestRemoveZeros(t *testing.T) {
testCases := map[string]struct {
a corev1.ResourceList
expected corev1.ResourceList
}{
"empty": {
a: corev1.ResourceList{},
expected: corev1.ResourceList{},
},
"all-zeros": {
a: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("0"),
corev1.ResourceMemory: resource.MustParse("0"),
},
expected: corev1.ResourceList{},
},
"some-zeros": {
a: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("0"),
corev1.ResourceMemory: resource.MustParse("0"),
corev1.ResourceStorage: resource.MustParse("100Gi
"),
},
expected: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse("100Gi
"),
},
},
"non-zero": {
a: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("200m")
,
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
expected: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("200m")
,
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
},
}
for testName, testCase := range testCases {
if result := RemoveZeros(testCase.a); !Equals(result, testCase.ex
pected) {
t.Errorf("%s expected: %v, actual: %v", testName, testCas
e.expected, result)
}
}
}
func TestIsNegative(t *testing.T) { func TestIsNegative(t *testing.T) {
testCases := map[string]struct { testCases := map[string]struct {
a corev1.ResourceList a corev1.ResourceList
expected []corev1.ResourceName expected []corev1.ResourceName
}{ }{
"empty": { "empty": {
a: corev1.ResourceList{}, a: corev1.ResourceList{},
expected: []corev1.ResourceName{}, expected: []corev1.ResourceName{},
}, },
"some-negative": { "some-negative": {
 End of changes. 1 change blocks. 
0 lines changed or deleted 50 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)