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

   ### Task Summary
   
   
`amber/src/main/scala/org/apache/texera/web/resource/dashboard/DatasetSearchQueryBuilder.scala`
 sits at 58.6% — 24 missed of 58 lines and only 6 of 18 branches. The existing 
`DatasetSearchQueryBuilderSpec` has 9 tests and asserts on rendered SQL only, 
so `toEntryImpl` — the half that builds what the dashboard actually displays — 
is entirely unexercised.
   
   Worth establishing before writing anything, because the obvious approaches 
all fail here:
   
   1. **`toEntryImpl` is `override protected` on this builder**, while the 
`Project` and `Workflow` siblings widen theirs to `override def`. So the 
pattern `ProjectSearchQueryBuilderSpec` uses does not transfer, and widening 
the modifier would be a production edit. The route in is the trait's public 
`toEntry`, which first runs `UnifiedResourceSchema.translateRecord` — meaning 
the input record must carry the **aliased** select fields, not the raw 
`DATASET.*` fields. Fetching the builder's own query is what supplies them.
   2. **`toEntryImpl` calls LakeFS.** Line 137 reaches 
`LakeFSStorageClient.retrieveRepositorySize`, which has no seam — 
`HubResourceSpec` gives up on exactly this, noting that an empty id list is the 
only input exercisable without a LakeFS server. A loopback 
`com.sun.net.httpserver` stub has to be duplicated into amber's test tree, 
because `amber/build.sbt` declares only `DAO % "test->test"` and `Auth % 
"test->test"`, so `workflow-core`'s existing stub is not on amber's test 
classpath.
   3. **Do not repoint `StorageConfig.lakefsEndpoint` to reach that stub.** 
`LakeFSStorageClient`'s `apiClient`, `refsApi` and `objectsApi` are private 
`lazy val`s that capture the endpoint once per JVM, and amber has 
`Tags.limit(Tags.Test, 1)` but no `Test / fork`, so the whole module shares one 
JVM. `workflow-core` gets away with mutating that global only because it forks 
its `@NonParallelTest` suites. In amber the same move is order-dependent and 
leaves the client pointed at a dead port for every later suite. Bind the stub 
**at** the host and port the config already names instead — order-independent, 
nothing memoized wrongly.
   4. **Consequence: the port is machine-global.** A local `bin/local-dev.sh 
up` LakeFS, or a sibling worktree running amber tests, takes it, and the 
stub-dependent tests then have to `cancel`. That is a documented environmental 
skip rather than a failure, but be aware a cancel disarms the assertions too — 
it shows up only as `canceled N`, with the build still green.
   5. **`FulltextSearchQueryUtils.usePgroonga` is a JVM-global `var` defaulting 
to true.** Executing the query, as opposed to only rendering it, needs it false 
against plain postgres. `DatasetResourceSpec` already sets it false in 
`beforeAll` and never restores it, so that is the de-facto JVM state — an 
unrestored global the new tests inherit.
   6. **Line 141 can never be fully covered**: `javap` shows scala-logging 
expanding the error log into a one-sided `isErrorEnabled` guard.
   
   ### 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