Skip to content

Commit 36144e0

Browse files
committed
test: add a check that a specific error has occurred.
1 parent 591c75e commit 36144e0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/e2e/node/pod_resize.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ func doPodResizeAdmissionPluginsTests() {
170170
ginkgo.By("patching pod for resize with memory exceeding resource quota")
171171
_, pErrExceedMemory := f.ClientSet.CoreV1().Pods(resizedPod.Namespace).Patch(ctx,
172172
resizedPod.Name, types.StrategicMergePatchType, []byte(patchStringExceedMemory), metav1.PatchOptions{}, "resize")
173-
gomega.Expect(pErrExceedMemory).To(gomega.HaveOccurred(), tc.wantMemoryError)
173+
gomega.Expect(pErrExceedMemory).To(gomega.HaveOccurred())
174+
gomega.Expect(pErrExceedMemory).To(gomega.MatchError(gomega.ContainSubstring(tc.wantMemoryError)))
174175

175176
ginkgo.By("verifying pod patched for resize exceeding memory resource quota remains unchanged")
176177
patchedPodExceedMemory, pErrEx2 := podClient.Get(ctx, resizedPod.Name, metav1.GetOptions{})
@@ -181,7 +182,8 @@ func doPodResizeAdmissionPluginsTests() {
181182
ginkgo.By(fmt.Sprintf("patching pod %s for resize with CPU exceeding resource quota", resizedPod.Name))
182183
_, pErrExceedCPU := f.ClientSet.CoreV1().Pods(resizedPod.Namespace).Patch(ctx,
183184
resizedPod.Name, types.StrategicMergePatchType, []byte(patchStringExceedCPU), metav1.PatchOptions{}, "resize")
184-
gomega.Expect(pErrExceedCPU).To(gomega.HaveOccurred(), tc.wantCPUError)
185+
gomega.Expect(pErrExceedCPU).To(gomega.HaveOccurred())
186+
gomega.Expect(pErrExceedCPU).To(gomega.MatchError(gomega.ContainSubstring(tc.wantCPUError)))
185187

186188
ginkgo.By("verifying pod patched for resize exceeding CPU resource quota remains unchanged")
187189
patchedPodExceedCPU, pErrEx1 := podClient.Get(ctx, resizedPod.Name, metav1.GetOptions{})

0 commit comments

Comments
 (0)