mengw15 commented on code in PR #7656:
URL: https://github.com/apache/texera/pull/7656#discussion_r3780846870
##########
amber/src/test/scala/org/apache/texera/web/resource/pythonvirtualenvironment/PveResourceSpec.scala:
##########
@@ -453,6 +453,27 @@ class PveResourceSpec
pves.map(_.get("pveName")) should contain(testPveName)
}
+ it should "return an empty list for a computing unit with no environments"
in {
+ val resp = new PveResource().fetchPVEs(Int.box(testCuid + 1))
+
+ resp.getStatus shouldBe Response.Status.OK.getStatusCode
+ resp.getEntity.asInstanceOf[java.util.List[_]].asScala shouldBe empty
+ }
Review Comment:
Good catch — this was a real cross-run flake: `testCuid` is hardcoded (256),
so `testCuid + 1` was too, and `afterEach` never cleaned it. `unusedCuid()` now
searches for an id with no directory under the venv root. Verified by creating
`/tmp/texera-pve/venvs/257/leftover-env` (exactly what the old code would have
picked up) and re-running: still 36/36 green.
##########
amber/src/test/scala/org/apache/texera/web/resource/pythonvirtualenvironment/PveResourceSpec.scala:
##########
@@ -469,4 +490,45 @@ class PveResourceSpec
val resp = new PveResource().deletePackage(testCuid, testPveName,
"pyarrow")
resp.getStatus shouldBe Response.Status.BAD_REQUEST.getStatusCode
}
+
+ // ─── conflict and error branches
───────────────────────────────────────────
+ // The unique index on (uid, name) is what surfaces a duplicate as SQLSTATE
23505,
+ // so these drive real constraint violations rather than mocking the DAO.
Review Comment:
Renamed to "duplicate-name conflicts". The comment now also records why the
500 handlers aren't covered: `PveManager.getSystemPackages` returns a cached
value and never throws, and the generic `case e: Exception` arms need the DAO
mocked to reach.
--
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]