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

   ### Task Summary
   
   Two files on the websocket path are effectively unverified.
   
   `amber/src/main/scala/org/apache/texera/web/ServletAwareConfigurator.scala` 
has **no spec at all** and reports **0% of 27 lines**. It is the handshake hook 
wired into both production endpoints via `@ServerEndpoint(configurator = ...)` 
(`WorkflowWebsocketResource.scala:46`, `CollaborationResource.scala:52`), so it 
decides, for every connection, who the user is and what computing-unit 
privilege they carry. `WorkflowWebsocketResource.scala` then consumes exactly 
what it wrote, and sits at **53.2%** with `myOnOpen` entirely uncovered.
   
   All of it is drivable with no container, no DB, no cluster and no network. 
`modifyHandshake`'s three parameters are plain interfaces a test can stub. 
`JwtAuth.jwtToken` is public and signs with the same secret `jwtConsumer` 
verifies, so a token can be minted in-process -- 
`common/auth/src/test/scala/org/apache/texera/auth/JwtParserSpec.scala` already 
does this in a plain `AnyFlatSpec`. `ClusterListener.numWorkerNodesInCluster` 
is a bare `var` on the companion, readable with no cluster.
   
   Four traps here produce assertions that look strong and pin nothing:
   
   1. **`noException should be thrownBy modifyHandshake(...)`** on malformed 
input passes if the entire method body is deleted. The swallow comes from the 
try/catch shape, not from any line inside it. Assert the exact partial state 
the failure leaves: a garbage `x-user-id` leaves the properties completely 
empty, whereas a tampered token leaves only the privilege entry.
   2. **Asserting the built `User`'s untouched fields** (`getRole`, 
`getAvatar`, `getComment`) pins nothing -- those are the jOOQ POJO's defaults 
and this code never sets them.
   3. **One "no headers present -> single-node" test does not pin the four-way 
`&&`.** It pins only that the conjunction is false, so deleting any one leg 
still passes. Each `contains` needs its own 3-of-4 case.
   4. **`ClusterStatusUpdateEvent.numWorkers shouldBe 0`** matches the literal 
initializer of `numWorkerNodesInCluster`, so it holds with the production 
argument replaced by a hard-coded `0`. Assert the event's presence and *order* 
instead -- `myOnOpen` has a comment saying the ordering is deliberate.
   
   Also worth knowing before measuring: amber has no `logback-test.xml`, so 
`amber/src/main/resources/logback.xml` governs the test JVM and sets 
`org.apache` to `WARN`. A `logger.info` interpolation therefore never executes 
even though its `isEnabled` guard registers as a hit.
   
   ### 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