Skip to content

Commit 693c740

Browse files
lolgabjoan38
authored andcommitted
Update PodsApiTest to check for Ready state
1 parent ab2f851 commit 693c740

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kubernetes-client/test/src/com/goyeau/kubernetes/client/api/PodsApiTest.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,16 @@ class PodsApiTest
277277
.unsafeRunSync()
278278
}
279279

280-
private val podStatusCount = 4
281-
282280
def waitUntilReady(namespaceName: String, name: String)(implicit client: KubernetesClient[IO]): IO[Pod] =
283281
retry(
284282
for {
285283
pod <- getChecked(namespaceName, name)
286-
notStarted = pod.status.flatMap(_.conditions.map(_.exists(c => c.status == "False"))).getOrElse(false)
287-
statusCount = pod.status.flatMap(_.conditions.map(_.length)).getOrElse(0)
284+
isReady = pod.status.exists(_.conditions.exists(_.exists {
285+
case PodCondition("Ready", "True", _, _, _, _) => true
286+
case _ => false
287+
}))
288288
_ <-
289-
if (notStarted || statusCount != podStatusCount)
289+
if (!isReady)
290290
IO.raiseError(
291291
new RuntimeException(
292292
s"Pod is not started: ${pod.status.flatMap(_.conditions).toSeq.flatten.map(_.asJson.noSpaces).mkString(", ")}"

0 commit comments

Comments
 (0)