chore: Optimizing the context information for assertions on boolean types.

This commit is contained in:
zhifei92 2024-08-25 22:24:22 +08:00 committed by zhangzhifei16
parent 0bcbc3b77a
commit fc7dadf370
2 changed files with 7 additions and 6 deletions

View File

@ -129,7 +129,8 @@ while true; do sleep 1; done
ginkgo.By(fmt.Sprintf("Container '%s': should be possible to delete", testContainer.Name)) ginkgo.By(fmt.Sprintf("Container '%s': should be possible to delete", testContainer.Name))
gomega.Expect(terminateContainer.Delete(ctx)).To(gomega.Succeed()) gomega.Expect(terminateContainer.Delete(ctx)).To(gomega.Succeed())
gomega.Eventually(ctx, terminateContainer.Present, ContainerStatusRetryTimeout, ContainerStatusPollInterval).Should(gomega.BeFalse()) errMsg := fmt.Sprintf("container '%s': should have been terminated by now.", testContainer.Name)
gomega.Eventually(ctx, terminateContainer.Present, ContainerStatusRetryTimeout, ContainerStatusPollInterval).Should(gomega.BeFalseBecause(errMsg))
} }
}) })
}) })

View File

@ -259,17 +259,17 @@ var _ = utils.SIGDescribe("CSI Mock volume storage capacity", func() {
// test. // test.
framework.Logf("PVC watch delivered incomplete data, cannot check annotation") framework.Logf("PVC watch delivered incomplete data, cannot check annotation")
case test.lateBinding: case test.lateBinding:
gomega.Expect(nodeAnnotationSet).To(gomega.BeTrue(), "selected-node should have been set") gomega.Expect(nodeAnnotationSet).To(gomega.BeTrueBecause("selected-node should have been set"))
// Whether it gets reset depends on whether we have topology enabled. Without // Whether it gets reset depends on whether we have topology enabled. Without
// it, rescheduling is unnecessary. // it, rescheduling is unnecessary.
if test.topology { if test.topology {
gomega.Expect(nodeAnnotationReset).To(gomega.BeTrue(), "selected-node should have been set") gomega.Expect(nodeAnnotationReset).To(gomega.BeTrueBecause("selected-node should have been set"))
} else { } else {
gomega.Expect(nodeAnnotationReset).To(gomega.BeFalse(), "selected-node should not have been reset") gomega.Expect(nodeAnnotationReset).To(gomega.BeFalseBecause("selected-node should not have been reset"))
} }
default: default:
gomega.Expect(nodeAnnotationSet).To(gomega.BeFalse(), "selected-node should not have been set") gomega.Expect(nodeAnnotationSet).To(gomega.BeFalseBecause("selected-node should not have been set"))
gomega.Expect(nodeAnnotationReset).To(gomega.BeFalse(), "selected-node should not have been reset") gomega.Expect(nodeAnnotationReset).To(gomega.BeFalseBecause("selected-node should not have been reset"))
} }
} }
}) })