aglinxinyuan commented on code in PR #9652:
URL: https://github.com/apache/texera/pull/9652#discussion_r4683702185


##########
computing-unit-managing-service/src/test/scala/org/apache/texera/service/util/ComputingUnitHelpersSpec.scala:
##########
@@ -105,15 +106,62 @@ class ComputingUnitHelpersSpec
   // uses, so these tests cover the snapshot extraction and the state mapping
   // together.
 
-  private def terminatingPod(): Pod =
-    new PodBuilder()
+  private val diskEvictionMessage =
+    "Pod ephemeral local storage usage exceeds the total limit of containers 
1Gi."
+  private val diskEvictionReason =
+    "The computing unit was evicted because it ran out of local disk storage. 
Consider " +
+      "storing less data on the unit's local file system, or recreate it with 
more storage."
+  private val imagePullReason =
+    "The computing unit's image could not be pulled. Please recreate the unit 
or contact " +
+      "an administrator."
+  private def crashLoopReason(restarts: Int): String =
+    s"The computing unit is repeatedly crashing (restarted $restarts times). 
Please terminate and " +
+      "recreate it, or contact an administrator."
+  private def clusterEvictionReason(detail: String): String =
+    s"The computing unit was evicted by the cluster ($detail). Consider 
recreating it."
+
+  private def terminatingPod(
+      phase: Option[String] = Some("Running"),
+      reason: Option[String] = None,
+      message: Option[String] = None
+  ): Pod = {
+    val base = new PodBuilder()
       .withNewMetadata()
       .withDeletionTimestamp("2026-08-20T00:00:00Z")
       .endMetadata()
-      .withNewStatus()
-      .withPhase("Running")
-      .endStatus()
+    phase
+      .fold(base) { p =>
+        val status = base.withNewStatus().withPhase(p)
+        val withReason = reason.fold(status)(status.withReason)
+        message.fold(withReason)(withReason.withMessage).endStatus()
+      }
       .build()
+  }

Review Comment:
   Done in f3c7f8989b: `terminatingPod(pod)` now adds the deletion timestamp to 
any pod, so the three tests read `terminatingPod(podWithPhase("Running"))`, 
`terminatingPod(statuslessPod())` and 
`terminatingPod(evictedPod(diskEvictionMessage))`, and the eviction-precedence 
test uses `diskEvictionMessage`.
   
   _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to