From 693c740e78b4d1c07337ab3d5de458817123a990 Mon Sep 17 00:00:00 2001 From: Lorenzo Gabriele Date: Mon, 3 Feb 2025 09:18:06 +0100 Subject: [PATCH] Update PodsApiTest to check for Ready state --- .../com/goyeau/kubernetes/client/api/PodsApiTest.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kubernetes-client/test/src/com/goyeau/kubernetes/client/api/PodsApiTest.scala b/kubernetes-client/test/src/com/goyeau/kubernetes/client/api/PodsApiTest.scala index 0f881e6..2385f89 100644 --- a/kubernetes-client/test/src/com/goyeau/kubernetes/client/api/PodsApiTest.scala +++ b/kubernetes-client/test/src/com/goyeau/kubernetes/client/api/PodsApiTest.scala @@ -277,16 +277,16 @@ class PodsApiTest .unsafeRunSync() } - private val podStatusCount = 4 - def waitUntilReady(namespaceName: String, name: String)(implicit client: KubernetesClient[IO]): IO[Pod] = retry( for { pod <- getChecked(namespaceName, name) - notStarted = pod.status.flatMap(_.conditions.map(_.exists(c => c.status == "False"))).getOrElse(false) - statusCount = pod.status.flatMap(_.conditions.map(_.length)).getOrElse(0) + isReady = pod.status.exists(_.conditions.exists(_.exists { + case PodCondition("Ready", "True", _, _, _, _) => true + case _ => false + })) _ <- - if (notStarted || statusCount != podStatusCount) + if (!isReady) IO.raiseError( new RuntimeException( s"Pod is not started: ${pod.status.flatMap(_.conditions).toSeq.flatten.map(_.asJson.noSpaces).mkString(", ")}"