@@ -26,7 +26,6 @@ import (
26
26
"k8s.io/apimachinery/pkg/util/uuid"
27
27
"k8s.io/kubernetes/test/e2e/framework"
28
28
imageutils "k8s.io/kubernetes/test/utils/image"
29
- "strconv"
30
29
31
30
"github.com/onsi/ginkgo"
32
31
)
@@ -104,7 +103,6 @@ var _ = ginkgo.Describe("[sig-node] PodTemplates", func() {
104
103
105
104
ginkgo .It ("should delete a collection of pod templates" , func () {
106
105
podTemplateNames := []string {"test-podtemplate-1" , "test-podtemplate-2" , "test-podtemplate-3" }
107
- podTemplateNamesCount := len (podTemplateNames )
108
106
109
107
ginkgo .By ("Create set of pod templates" )
110
108
// create a set of pod templates in test namespace
@@ -133,18 +131,7 @@ var _ = ginkgo.Describe("[sig-node] PodTemplates", func() {
133
131
})
134
132
framework .ExpectNoError (err , "failed to get a list of pod templates" )
135
133
136
- // check that we find all the pod templates created
137
- podTemplateListItemsCount := len (podTemplateList .Items )
138
- errMsg := "found " + strconv .Itoa (podTemplateListItemsCount ) + " pod templates when " + strconv .Itoa (podTemplateNamesCount ) + " pod templates where expected"
139
- logMsg := "found " + strconv .Itoa (podTemplateListItemsCount ) + " pod templates"
140
-
141
- foundCreatedSet := true
142
- if podTemplateListItemsCount != podTemplateNamesCount {
143
- foundCreatedSet = false
144
- } else {
145
- framework .Logf (logMsg )
146
- }
147
- framework .ExpectEqual (foundCreatedSet , true , errMsg )
134
+ framework .ExpectEqual (len (podTemplateList .Items ), len (podTemplateNames ), "looking for expected number of pod templates" )
148
135
149
136
ginkgo .By ("delete collection of pod templates" )
150
137
// delete collection
@@ -161,18 +148,7 @@ var _ = ginkgo.Describe("[sig-node] PodTemplates", func() {
161
148
})
162
149
framework .ExpectNoError (err , "failed to get a list of pod templates" )
163
150
164
- // check that we don't find any created pod templates
165
- podTemplateListItemsCount = len (podTemplateList .Items )
166
- errMsg = "found " + strconv .Itoa (podTemplateListItemsCount ) + " pod templates when zero pod templates where expected"
167
- logMsg = "found " + strconv .Itoa (podTemplateListItemsCount ) + " pod templates"
168
-
169
- foundCreatedSet = false
170
- if podTemplateListItemsCount != 0 {
171
- foundCreatedSet = true
172
- } else {
173
- framework .Logf (logMsg )
174
- }
175
- framework .ExpectEqual (foundCreatedSet , false , errMsg )
151
+ framework .ExpectEqual (len (podTemplateList .Items ), 0 , "pod templates should all be deleted" )
176
152
177
153
})
178
154
0 commit comments