aglinxinyuan opened a new issue, #7510:
URL: https://github.com/apache/texera/issues/7510

   ### Task Summary
   
   `KubernetesClientSpec` covers the pure fabric8-to-map transforms 
(`phasesByPodName`,
   `metricsByPodName`) and the namespace-wide wrappers, and stops there. The 
single-pod half of the
   class is untested: `getPodByName`, `podExists`, `getPodLimits`, `createPod`, 
`deletePod` and
   `generatePodURI` — **42 of the file's 62 lines**.
   
   None of it needs a cluster, and that is the point worth recording. The seam 
is already built and
   documented in the class's own scaladoc: `class KubernetesClient(client: 
io.fabric8.kubernetes.client.KubernetesClient)`
   takes the fabric8 client as a constructor parameter, with the production 
singleton bound to a real
   one via `object KubernetesClient extends KubernetesClient(new 
KubernetesClientBuilder().build())`.
   The existing spec's `stubbedClient` fixture already proves the Mockito 
approach; it only needs
   extending to the rest of the fluent chain — `withName(...).get()` for the 
lookups and
   `resource(pod).inNamespace(...).create()` for creation.
   
   Two traps:
   
   - `RETURNS_DEEP_STUBS` cannot be used — fabric8's fluent API returns type 
variables, so each step
     has to be mocked explicitly. The existing fixture already says this.
   - An `ArgumentCaptor` cannot be read from inside the `thenAnswer` that stubs 
`create()`; it is only
     populated by `verify(...).capture()` afterwards. Stub `create()` to return 
`null` and inspect the
     captured pod after the call.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
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