Skip to content

Commit 5706942

Browse files
committed
[SPARK-49381][K8S][TESTS] Fix SPARK-41388 test case to assert the result
### What changes were proposed in this pull request? This PR aims to fix a test case of SPARK-41388 by adding a missed assert. ### Why are the changes needed? To check the result correctly. ### Does this PR introduce _any_ user-facing change? No, this is a test case change. ### How was this patch tested? Pass the CIs with newly added assertion. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #47865 from dongjoon-hyun/SPARK-49381. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 4d5b4b5 commit 5706942

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

resource-managers/kubernetes/core/src/test/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocatorSuite.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,15 +845,17 @@ class ExecutorPodsAllocatorSuite extends SparkFunSuite with BeforeAndAfter {
845845
val getReusablePVCs =
846846
PrivateMethod[mutable.Buffer[PersistentVolumeClaim]](Symbol("getReusablePVCs"))
847847

848-
val pvc1 = persistentVolumeClaim("pvc-0", "gp2", "200Gi")
849-
val pvc2 = persistentVolumeClaim("pvc-1", "gp2", "200Gi")
848+
val pvc1 = persistentVolumeClaim("pvc-1", "gp2", "200Gi")
849+
val pvc2 = persistentVolumeClaim("pvc-2", "gp2", "200Gi")
850850

851851
val now = Instant.now()
852852
pvc1.getMetadata.setCreationTimestamp(now.minus(2 * podAllocationDelay, MILLIS).toString)
853853
pvc2.getMetadata.setCreationTimestamp(now.toString)
854854

855855
when(persistentVolumeClaimList.getItems).thenReturn(Seq(pvc1, pvc2).asJava)
856-
podsAllocatorUnderTest invokePrivate getReusablePVCs("appId", Seq("pvc-1"))
856+
val reusablePVCs = podsAllocatorUnderTest invokePrivate getReusablePVCs("appId", Seq.empty)
857+
assert(reusablePVCs.size == 1)
858+
assert(reusablePVCs.head.getMetadata.getName == "pvc-1")
857859
}
858860

859861
test("SPARK-41410: Support waitToReusePersistentVolumeClaims") {

0 commit comments

Comments
 (0)