Skip to content

Commit 758e3c7

Browse files
committed
Removing extra boilerplate from test
1 parent 7772a42 commit 758e3c7

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

test/e2e/common/podtemplates.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"k8s.io/apimachinery/pkg/util/uuid"
2727
"k8s.io/kubernetes/test/e2e/framework"
2828
imageutils "k8s.io/kubernetes/test/utils/image"
29-
"strconv"
3029

3130
"github.com/onsi/ginkgo"
3231
)
@@ -104,7 +103,6 @@ var _ = ginkgo.Describe("[sig-node] PodTemplates", func() {
104103

105104
ginkgo.It("should delete a collection of pod templates", func() {
106105
podTemplateNames := []string{"test-podtemplate-1", "test-podtemplate-2", "test-podtemplate-3"}
107-
podTemplateNamesCount := len(podTemplateNames)
108106

109107
ginkgo.By("Create set of pod templates")
110108
// create a set of pod templates in test namespace
@@ -133,18 +131,7 @@ var _ = ginkgo.Describe("[sig-node] PodTemplates", func() {
133131
})
134132
framework.ExpectNoError(err, "failed to get a list of pod templates")
135133

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")
148135

149136
ginkgo.By("delete collection of pod templates")
150137
// delete collection
@@ -161,18 +148,7 @@ var _ = ginkgo.Describe("[sig-node] PodTemplates", func() {
161148
})
162149
framework.ExpectNoError(err, "failed to get a list of pod templates")
163150

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")
176152

177153
})
178154

0 commit comments

Comments
 (0)