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

   ### What changes were proposed in this PR?
   
   Extends `PveResourceSpec` with the conflict and empty-result paths that were
   still unhit. No production code was changed. Everything runs on the spec's
   existing embedded-Postgres setup — the duplicate cases drive the real
   `(uid, name)` unique index rather than mocking the DAO.
   
   5 tests:
   
   - `savePve` — 409 with `An environment named "<name>" already exists.` when 
the
     user already owns that name, and the negative case: the same name under a
     *different* user still returns 201.
   - `listPves` — the empty-result arm for a user that owns nothing.
   - `fetchPVEs` — the empty-result arm for a computing unit with no 
environments.
   - `deleteEnvironments` — removes every environment of a computing unit, and 
is a
     no-op for one that has none.
   
   Measured with `sbt WorkflowExecutionService/jacoco` scoped to this spec:
   `PveResource.scala` goes from **49/59 to 50/59 lines**. That is smaller than 
the
   issue's estimate because most of what it lists is either already covered or 
not
   unit-reachable — details below, in case it is worth adjusting the issue:
   
   - `updatePve`'s 409-rename, 404 and 400 arms, and `getSystemPackages`' 
success
     path, are **already covered** by tests added in #7179.
   - `getSystemPackages`' `catch` is **unreachable**: 
`PveManager.getSystemPackages`
     just returns the cached `systemPackages` value and never shells out, so 
nothing
     in the call can throw.
   - The bad-JSON fallback in `listPves` is **unreachable**: `packages` is a 
`jsonb`
     column, so Postgres rejects a malformed document at insert time.
   - Of the 9 lines still missed, none is untested logic: two are 
single-instruction
     remnants on lines that do execute (`mi=1, ci=22` / `ci=4` — Scala bridge
     bytecode), four are the `catch` arms above, and the two conflict handlers 
are
     hit (`ci=19, cb=3`) with only the `sqlState != "23505"` guard path unhit, 
which
     needs a different database error to construct.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7653
   
   ### How was this PR tested?
   
   Unit tests, run locally against embedded Postgres. All pass, and the failure 
path
   was verified by breaking an assertion to confirm the suite goes red:
   
   ```
   sbt "WorkflowExecutionService/testOnly *PveResourceSpec"
   # Tests: succeeded 36, failed 0
   sbt "WorkflowExecutionService/Test/scalafmtCheck"      # clean
   sbt "WorkflowExecutionService/Test/scalafix --check"   # clean
   ```
   
   ### 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