Changed code to improve output messages on error for files under test/e2e/apps (#109944)
* Improving the output of tests in case of error * Better error message Also, the condition in the second case was reversed * Fixing 2 tests whose condition was inverted * Again I got the conditions wrong * Sorry for the confusion * Improved error messages on failures
This commit is contained in:
@@ -318,7 +318,9 @@ var _ = SIGDescribe("DisruptionController", func() {
|
||||
if c.shouldDeny {
|
||||
err = cs.CoreV1().Pods(ns).EvictV1(ctx, e)
|
||||
framework.ExpectError(err, "pod eviction should fail")
|
||||
framework.ExpectEqual(apierrors.HasStatusCause(err, policyv1.DisruptionBudgetCause), true, "pod eviction should fail with DisruptionBudget cause")
|
||||
if !apierrors.HasStatusCause(err, policyv1.DisruptionBudgetCause) {
|
||||
framework.Fail("pod eviction should fail with DisruptionBudget cause")
|
||||
}
|
||||
} else {
|
||||
// Only wait for running pods in the "allow" case
|
||||
// because one of shouldDeny cases relies on the
|
||||
@@ -362,7 +364,9 @@ var _ = SIGDescribe("DisruptionController", func() {
|
||||
}
|
||||
err = cs.CoreV1().Pods(ns).EvictV1(ctx, e)
|
||||
framework.ExpectError(err, "pod eviction should fail")
|
||||
framework.ExpectEqual(apierrors.HasStatusCause(err, policyv1.DisruptionBudgetCause), true, "pod eviction should fail with DisruptionBudget cause")
|
||||
if !apierrors.HasStatusCause(err, policyv1.DisruptionBudgetCause) {
|
||||
framework.Failf("pod eviction should fail with DisruptionBudget cause. The error was \"%v\"", err)
|
||||
}
|
||||
|
||||
ginkgo.By("Updating the pdb to allow a pod to be evicted")
|
||||
updatePDBOrDie(ctx, cs, ns, defaultName, func(pdb *policyv1.PodDisruptionBudget) *policyv1.PodDisruptionBudget {
|
||||
@@ -400,7 +404,9 @@ var _ = SIGDescribe("DisruptionController", func() {
|
||||
}
|
||||
err = cs.CoreV1().Pods(ns).EvictV1(ctx, e)
|
||||
framework.ExpectError(err, "pod eviction should fail")
|
||||
framework.ExpectEqual(apierrors.HasStatusCause(err, policyv1.DisruptionBudgetCause), true, "pod eviction should fail with DisruptionBudget cause")
|
||||
if !apierrors.HasStatusCause(err, policyv1.DisruptionBudgetCause) {
|
||||
framework.Failf("pod eviction should fail with DisruptionBudget cause. The error was \"%v\"", err)
|
||||
}
|
||||
|
||||
ginkgo.By("Deleting the pdb to allow a pod to be evicted")
|
||||
deletePDBOrDie(ctx, cs, ns, defaultName)
|
||||
|
Reference in New Issue
Block a user