Skip to content

Commit b3c7256

Browse files
authored
Merge pull request kubernetes#126842 from saschagrunert/hugepages-test
Fix hugepages e2e test assertion
2 parents cee4304 + 14476d8 commit b3c7256

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/e2e_node/hugepages_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ var _ = SIGDescribe("HugePages", framework.WithSerial(), feature.HugePages, "[No
225225
restartKubelet(true)
226226

227227
ginkgo.By("verifying that the hugepages-3Mi resource no longer is present")
228-
gomega.Eventually(ctx, func() resource.Quantity {
228+
gomega.Eventually(ctx, func() bool {
229229
node, err = f.ClientSet.CoreV1().Nodes().Get(ctx, framework.TestContext.NodeName, metav1.GetOptions{})
230230
framework.ExpectNoError(err, "while getting node status")
231-
// abc, error := node.Status.Capacity["hugepages-3Mi"]
232-
return node.Status.Capacity["hugepages-3Mi"]
233-
}, 30*time.Second, framework.Poll).Should(gomega.BeNil())
231+
_, isPresent := node.Status.Capacity["hugepages-3Mi"]
232+
return isPresent
233+
}, 30*time.Second, framework.Poll).Should(gomega.BeFalseBecause("hugepages resource should not be present"))
234234
})
235235

236236
ginkgo.It("should add resources for new huge page sizes on kubelet restart", func(ctx context.Context) {
@@ -245,11 +245,12 @@ var _ = SIGDescribe("HugePages", framework.WithSerial(), feature.HugePages, "[No
245245
startKubelet()
246246

247247
ginkgo.By("verifying that the hugepages-2Mi resource is present")
248-
gomega.Eventually(ctx, func() resource.Quantity {
248+
gomega.Eventually(ctx, func() bool {
249249
node, err := f.ClientSet.CoreV1().Nodes().Get(ctx, framework.TestContext.NodeName, metav1.GetOptions{})
250250
framework.ExpectNoError(err, "while getting node status")
251-
return node.Status.Capacity["hugepages-2Mi"]
252-
}, 30*time.Second, framework.Poll).ShouldNot(gomega.BeNil())
251+
_, isPresent := node.Status.Capacity["hugepages-2Mi"]
252+
return isPresent
253+
}, 30*time.Second, framework.Poll).Should(gomega.BeTrueBecause("hugepages resource should be present"))
253254
})
254255

255256
ginkgo.When("start the pod", func() {

0 commit comments

Comments
 (0)