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

   ### Task Summary
   
   The second half of `DatasetResource`'s 86 uncovered lines (codecov **62.06 
%**) is its public read path: the presigned-download endpoints, the anonymous 
dataset/version reads, and the file-node tree they return. None of these 
endpoints is ever called by a test today.
   
   `DatasetResourceSpec` already provides everything needed — it extends both 
`MockTexeraDB` and `MockLakeFS`, so the LakeFS and MinIO endpoints are stood up 
and `StorageConfig.lakefsEndpoint` is repointed at them for the duration of the 
suite. This is a pure EXTEND; no new test infrastructure is required.
   
   ### Behavior to add
   
   **`DatasetResource`** 
(`file-service/src/main/scala/org/apache/texera/service/resource/DatasetResource.scala`,
 codecov 62.06 % — EXTEND `DatasetResourceSpec`)
   
   - `getPublicPresignedUrl` (line 799) and `getPublicPresignedUrlWithS3` (line 
810) — both `@PermitAll` endpoints delegate to 
`generatePresignedResponse(encodedUrl, repositoryName, commitHash, null)` with 
a null user. Cover each through the resource method, asserting the returned 
`Response` status and that the presigned address it hands back points at the 
mock's endpoint.
   - `generatePresignedResponse` (lines 1589–1592) and `decodedPathStr` (lines 
1616–1627) — the shared body behind them. `decodedPathStr` decodes the 
`filePath` query parameter; cover an encoded path containing characters that 
actually need decoding as well as a plain one, and whatever failure arm the 
decode has.
   - `getPublicDataset` (line 1501) — the `@PermitAll` `/public/{did}` read. 
Assert it returns the dashboard dataset for a public dataset and refuses a 
private one.
   - `retrievePublicDatasetVersionRootFileNodes` (line 1481) — delegates to 
`fetchDatasetVersionRootFileNodes(ctx, did, dvid, None)` with no user. Assert 
the returned `DatasetVersionRootFileNodesResponse` for a version whose files 
the mock serves.
   - `datasetsNode` (lines 1553–1557) and `ownerFileNode` (lines 1562–1578) — 
the tree assembly beneath those reads. Seed a version with files under more 
than one directory so the nesting is built rather than a single flat node, and 
cover the owner-attribution branch.
   - `getDatasetVersionZip` (line 1386) — assert the response the zip endpoint 
produces for a version the mock serves.
   
   Determinism notes:
   - Drive everything through the mock endpoints the spec already starts; never 
point at a real LakeFS or S3 host, and never assert on a port number or a full 
absolute URL that embeds one.
   - Seed the files each assertion reads inside the test rather than depending 
on another test's uploads.
   - Assert on structure (node names, nesting, status codes), not on byte sizes 
or timestamps that the storage layer may report differently between runs.
   - If a case needs a failure from storage, produce it through the mock rather 
than by taking the service down, so the test does not depend on 
connection-error timing.
   
   Out of scope: the purely DB-side publicity toggles, description update and 
public version list, which are covered separately.
   
   Verify locally before opening the PR: `sbt FileService/testOnly 
*DatasetResourceSpec`, plus `scalafmtCheck` and `scalafix --check`.
   
   ### 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