mengw15 opened a new issue, #7653: URL: https://github.com/apache/texera/issues/7653
### Task Summary `PveResource` (`amber/src/main/scala/org/apache/texera/web/resource/pythonvirtualenvironment/PveResource.scala`) is at ~75% — the happy paths are covered (#7179), but every **error branch** is unhit: 13 uncovered lines, all of them duplicate-name conflicts and exception handlers. **Goal: bring the file to full coverage** — add the failure cases below and use the coverage report to catch anything left. The spec already runs on embedded Postgres via `MockTexeraDB`, so this is metadata-only; no virtualenv is created. ### Behavior to add Extend `PveResourceSpec` (it already has the `MockTexeraDB` setup — `initializeDBAndReplaceDSLContext()`, DAOs seeded in `beforeEach`) with the uncovered failure paths: **Duplicate-name conflicts (409)** - `savePve` — seed a PVE, then save another with the same name for the same user; assert the response is `Response.Status.CONFLICT` and the entity reads `An environment named "<name>" already exists.` - `updatePve` — rename a PVE onto a name already taken by another environment; assert the same `CONFLICT` status and message. - Also assert the negative case: the same name under a *different* user (or a rename to an unused name) still succeeds. **Exception handlers (500)** - `getSystemPackages` — drive it into its `catch` arm and assert it throws `InternalServerErrorException` with `"Failed to get system packages."`. - `savePve` / `updatePve` — cover their generic `case e: Exception` arms; assert the thrown `InternalServerErrorException` message is `Failed to save PVE: …` / `Failed to update PVE: …`. Trigger these by seeding state the operation cannot satisfy (e.g. a cuid/veid with no matching row, or a payload that violates a column constraint) rather than by mocking the DAO. **Remaining lines** - `deleteEnvironments` and the PVE listing (`pves`) each have one unhit line — cover the branch they guard (an empty result / nothing to delete). - The `SavePvePayload` and `PveListItem` case-class lines are covered incidentally once the above construct them. ### 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]
