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:
Rafa de Castro
2023-01-11 11:11:44 +01:00
committed by GitHub
parent cfa6ad50e6
commit a887a3b4fd
7 changed files with 98 additions and 32 deletions

View File

@@ -325,7 +325,9 @@ var _ = SIGDescribe("Deployment", func() {
break
}
}
framework.ExpectEqual(foundDeployment, true, "unable to find the Deployment in list", deploymentsList)
if !foundDeployment {
framework.Failf("unable to find the Deployment in the following list %v", deploymentsList)
}
ginkgo.By("updating the Deployment")
testDeploymentUpdate := testDeployment
@@ -681,7 +683,9 @@ func stopDeployment(ctx context.Context, c clientset.Interface, ns, deploymentNa
framework.Logf("Ensuring deployment %s was deleted", deploymentName)
_, err = c.AppsV1().Deployments(ns).Get(ctx, deployment.Name, metav1.GetOptions{})
framework.ExpectError(err)
framework.ExpectEqual(apierrors.IsNotFound(err), true)
if !apierrors.IsNotFound(err) {
framework.Failf("Expected deployment %s to be deleted", deploymentName)
}
framework.Logf("Ensuring deployment %s's RSes were deleted", deploymentName)
selector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector)
framework.ExpectNoError(err)