Skip to content

Commit

Permalink
Update PodsApiTest to check for Ready state
Browse files Browse the repository at this point in the history
  • Loading branch information
lolgab authored and joan38 committed Feb 3, 2025
1 parent ab2f851 commit 693c740
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ")}"
Expand Down

0 comments on commit 693c740

Please sign in to comment.