mengw15 opened a new pull request, #7168:
URL: https://github.com/apache/texera/pull/7168

   ### What changes were proposed in this PR?
   
   Adds `UserQuotaResourceSpec` for `UserQuotaResource` (previously ~0% 
coverage,
   no spec). The suite runs against embedded Postgres via `MockTexeraDB` and 
seeds
   users / workflows / versions / executions / datasets through the generated 
DAOs.
   
   13 tests, each starting from a clean slate (so they are order-independent):
   
   - `getUserCreatedWorkflow` — empty list when the user owns no workflows; the 
owned workflows with their id / name / creation time when `WORKFLOW_OF_USER` is 
seeded.
   - `getUserAccessedWorkflow` — empty list with no grants; the accessible 
workflow ids from `WORKFLOW_USER_ACCESS`.
   - `getUserQuotaSize` — empty array with no executions; the assembled 
per-execution `resultBytes` / `runTimeStatsBytes` / `logBytes` (seeded across 
`WORKFLOW_EXECUTIONS.RUNTIME_STATS_SIZE`, 
`OPERATOR_PORT_EXECUTIONS.RESULT_SIZE`, and 
`OPERATOR_EXECUTIONS.CONSOLE_MESSAGES_SIZE`).
   - The JAX-RS endpoints (`getCreatedWorkflow`, `getAccessedWorkflow`, 
`getUserQuota`, `getCreatedDatasets`) via a `new SessionUser`, covering the 
thin delegation wrappers; `getCreatedDatasets` covers the empty case and the 
created-datasets case (size is deterministically 0 — the size calculation is 
disabled in the current dataset implementation).
   - `deleteExecutionCollection` and the `deleteCollection` endpoint — assert 
the execution row is removed from `WORKFLOW_EXECUTIONS`.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7162
   
   ### How was this PR tested?
   
   New unit tests, run locally against embedded Postgres:
   
   ```
   sbt "WorkflowExecutionService/testOnly 
org.apache.texera.web.resource.dashboard.user.quota.UserQuotaResourceSpec"
   # Tests: succeeded 13, failed 0
   sbt "WorkflowExecutionService/Test/scalafmtCheck" 
"WorkflowExecutionService/Test/scalafix --check"   # clean
   ```
   
   The failure path was verified by deliberately breaking an assertion and
   confirming the suite goes red. To keep the suite deterministic, the
   `creationTime` assertion compares against the DB round-tripped value rather 
than
   the in-memory timestamp (Postgres rounds the stored value, so an exact
   in-memory comparison would be flaky).
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8 [1M context])
   


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