You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/08/15 03:05:34 UTC

[I] Cover the websocket handshake configurator and the session wiring it feeds [texera]

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: notifications-unsubscribe@texera.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Cover the websocket handshake configurator and the session wiring it feeds [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan closed issue #7675: Cover the websocket handshake configurator and the session wiring it feeds
URL: https://github.com/apache/texera/issues/7675


-- 
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: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org