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

   ### Task Summary
   
   `common/workflow-core/.../storage/model/LakeFSFileDocument.scala` sits at 
**31.2%**, and its sibling `.../storage/util/LakeFSStorageClient.scala` at 
**83.6%**. The obvious assumption is that both are Docker/LakeFS-gated. **That 
assumption is wrong, and the repo already proves it.**
   
   `LakeFSStorageClientSpec` (merged in #7273) drives `LakeFSStorageClient` 
against an in-process `com.sun.net.httpserver` loopback stub that speaks enough 
of the lakeFS REST API for the generated SDK — no Docker, no MinIO, no 
testcontainer. It sets `StorageConfig.lakefsEndpoint` (a `var`, 
`StorageConfig.scala:72`) in `beforeAll` before anything forces the private 
`lazy val apiClient`, and is tagged `@NonParallelTest` so 
`common/workflow-core/build.sbt`'s `testGrouping` gives it its own forked JVM. 
It already has passing tests for the exact two calls `LakeFSFileDocument` 
makes: `getFilePresignedUrl` and `getFileFromRepo`.
   
   Two further facts make the document's main path reachable:
   
   - **`USER_JWT_TOKEN` is never set** in CI, dev shells, or build files — its 
only writer is `ComputingUnitManagingResource.scala:431`, which injects it into 
K8s pod env. So `userJwtToken.isEmpty` is reliably true in every test JVM, 
making the LakeFS/presign half of `asInputStream` the *live* branch.
   - `LakeFSFileDocument` is `private[storage]` and the spec shares its 
package, so it can be instantiated directly — no seam needed.
   
   Coverable without touching production: `asInputStream`'s presign path and 
its fallback path (note the local `def fallbackToLakeFS` lifts to 
`fallbackToLakeFS$1`, a real counted method — **not** an `$anonfun$`, which 
JaCoCo's synthetic filter would drop), `asFile` both arms including the 
`tempFile` memoization, `clear` both arms, and `LakeFSStorageClient.put`.
   
   Out of reach for a test-only change: the `userJwtToken`-non-empty branch 
(~lines 133-161). Reaching it needs a forked JVM with `USER_JWT_TOKEN` set 
**and** a file-service presign endpoint on a *fixed* port known before JVM 
start — a `build.sbt` `testGrouping` change plus a hardcoded port that can 
collide in CI.
   
   Also worth knowing: the six existing partials are structural and none is 
closable — Scala 2.13 lazy-val bitmaps on `userJwtToken` / 
`datasetPresignEndpoint` / `modelPresignEndpoint`, and the scalac `MatchError` 
arm on the exhaustive `resourceType` match.
   
   ### 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