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

   ### What changes were proposed in this PR?
   
   Extends the existing `CollaborationResourceSpec` to cover the 
`TryLockRequest`
   branches that consult the database
   
(`amber/src/main/scala/org/apache/texera/web/resource/CollaborationResource.scala`).
   The prior spec (#6904) left these uncovered because they reach
   `WorkflowAccessResource.hasWriteAccess`, which needs `SqlServer`. No 
production
   code was changed.
   
   The suite now also mixes in `MockTexeraDB`: for these three tests a user, a
   workflow and one `workflow_user_access` row are seeded so
   `checkIsReadOnly` → `hasWriteAccess` reads a real privilege. The session is 
still
   driven through `myOnMsg` with the existing mocked `javax.websocket.Session`, 
and
   outgoing events are asserted from the captured send buffer. +3 tests:
   
   - read-only user (`workflow_user_access` = READ) → `LockRejectedEvent` +
     `WorkflowAccessEvent(workflowReadonly=true)`, and the holder slot is set 
to the
     `null` sentinel.
   - writable user (WRITE) with no current holder → 
`WorkflowAccessEvent(readonly=false)`
     + `LockGrantedEvent`, and the holder becomes the sender.
   - writable user when a different session already holds the lock →
     `WorkflowAccessEvent(readonly=false)` + `LockRejectedEvent`, holder 
unchanged.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7228
   
   ### How was this PR tested?
   
   Extended unit tests, run locally against embedded Postgres (`MockTexeraDB`). 
All
   pass, and the failure path was verified by breaking an assertion to confirm 
the
   suite goes red:
   
   ```
   sbt "WorkflowExecutionService/testOnly *CollaborationResourceSpec"
   # Tests: succeeded 16, 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