Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More context on error on WaitUntilPodAvailable #1222

Closed
lahabana opened this issue Jan 6, 2023 · 0 comments · Fixed by #1223
Closed

More context on error on WaitUntilPodAvailable #1222

lahabana opened this issue Jan 6, 2023 · 0 comments · Fixed by #1223

Comments

@lahabana
Copy link
Contributor

lahabana commented Jan 6, 2023

When writing tests it's useful to figure why a pod failed to start.

For example we use heavily terratest in our e2e suite on kumahq/kuma.
Some tests are flaky for many possible reasons. When investigating them we have to switch to using:
WaitUntilPodAvailableE and use the error to get the pod again to extract the status. Something like:

err := WaitUntilPodAvailableE(...)
if err, ok := err.(k8s.PodNotAvailable); ok {
   p := GetPod(...)
   Logf("bad status", p.status.Message, p.status.Status)
}
require.NoError(err)

Not only there's a race here (possibly the pod gets healthy right after failing but it's also not super easy.

2 options:

  1. add pod.Status.{Reason,Message} to PodNotAvailable error
  2. make Pod in PodNotAvailable accessible outside the package.

I have a preference for 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant