HwangDongJun commented on code in PR #58187:
URL: https://github.com/apache/spark/pull/58187#discussion_r4345294010
##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/submit/ClientSuite.scala:
##########
@@ -180,28 +210,52 @@ class ClientSuite extends SparkFunSuite with
BeforeAndAfter {
when(podOperations.inNamespace(kconf.namespace)).thenReturn(podsWithNamespace)
when(podsWithNamespace.withName(POD_NAME)).thenReturn(namedPods)
+ events.clear()
createdPodArgumentCaptor = ArgumentCaptor.forClass(classOf[Pod])
createdResourcesArgumentCaptor =
ArgumentCaptor.forClass(classOf[Array[HasMetadata]])
- when(podsWithNamespace.resource(fullExpectedPod())).thenReturn(namedPods)
+ patchContextCaptor = ArgumentCaptor.forClass(classOf[PatchContext])
+ patchBodyCaptor = ArgumentCaptor.forClass(classOf[String])
+
when(podsWithNamespace.resource(createdPodArgumentCaptor.capture())).thenReturn(namedPods)
+
when(podOperations.resource(ArgumentMatchers.any[Pod]())).thenReturn(namedPods)
Review Comment:
Added. The stub for `podOperations.resource(...)` now records the pod it was
called with, and the tests check it:
- the gate PATCH goes through the pod that `create()` returned (UID check);
- the failure-path DELETE after a failed PATCH, and the DELETE after a
failed post-resource apply, go through that pod as well.
Replacing `resource(createdDriverPod)` with `resource(podToCreate)` in the
gate block passed before and now fails 2 tests. I did not add a test with a
template namespace that differs from `spark.kubernetes.namespace`; the check is
on the object the calls receive.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]