Skip to content

Commit

Permalink
[SPARK-49381][K8S][TESTS] Fix SPARK-41388 test case to assert the r…
Browse files Browse the repository at this point in the history
…esult

### 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>
  • Loading branch information
dongjoon-hyun committed Aug 26, 2024
1 parent 4d5b4b5 commit 5706942
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,17 @@ class ExecutorPodsAllocatorSuite extends SparkFunSuite with BeforeAndAfter {
val getReusablePVCs =
PrivateMethod[mutable.Buffer[PersistentVolumeClaim]](Symbol("getReusablePVCs"))

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

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

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

test("SPARK-41410: Support waitToReusePersistentVolumeClaims") {
Expand Down

0 comments on commit 5706942

Please sign in to comment.