xtf-cz / xtf

MIT License
12 stars 55 forks source link

Stop raising illegalArgumentException when no pod found in #getAnyPod #563

Open vsalbaba opened 5 months ago

vsalbaba commented 5 months ago

OpenShift#getAnyPod raises IllegalArgumentException when no pod is found. This is caused by the size of the results (0) being used to call Random#nextInt. nextInt will raise IllegalArgumentException when called with non-positive number.

This behaviour is not documented in the javadoc for getAnyPod nor apparent from the source code. However, the user of #getAnyPod did not provide any illegal arguments, and the exception is not helpful.

I propose raising a labeld RuntimeException instead.