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

   ### Task Summary
   
   #6446 added ComputingUnitAccessResourceSpec (embedded Postgres via 
MockTexeraDB) but scoped it to the two methods it fixed, which are grantAccess 
and revokeAccess. The rest of ComputingUnitAccessResource is only exercised 
incidentally, with no direct assertions. This task extends the spec to cover 
the whole resource, using the DB-backed test wiring #6446 already put in place 
(DAO % "test->test", forked test JVM with COMPUTING_UNIT_SHARING_ENABLED=true).
   
   Add direct tests for:
   
   - getComputingUnitAccessList: empty list, multiple grantees with distinct 
privileges, and correct email/name/privilege mapping.
   - Privilege helpers: isOwner (owner true / non-owner false / nonexistent 
cuid false), getPrivilege (NONE/READ/WRITE), hasReadAccess and hasWriteAccess 
across owner, READ-grantee, WRITE-grantee, and no-grant users.
   - Sharing-disabled path: with sharing off, the endpoints throw 
ForbiddenException (403) from ensureSharingIsEnabled().
   - getOwner happy path: returns the owner's email. (The nonexistent-unit → 
404 case is covered by #6475 / Follow-up PR)
   
   Note on the sharing-disabled test: 
ComputingUnitConfig.sharingComputingUnitEnabled is resolved once as a load-time 
val from the COMPUTING_UNIT_SHARING_ENABLED env var, and the existing suite 
forks with it set to true. Testing the disabled path can't just flip a flag at 
runtime, but it needs either a separate forked test suite/JVM with the env var 
unset, or a small refactor of ComputingUnitConfig to make the flag overridable 
per-test. Whoever picks this up should account for that.
   
   Optional, non-blocking hardening that can ride along if convenient (not the 
focus of this task):
   
   Null-guard the two userDao.fetchOneByUid(...).getEmail derefs in getOwner / 
getComputingUnitAccessList (currently unreachable due to ON DELETE CASCADE FKs, 
so defensive only).
   Extract the shared write-access guard in grant/revoke into an 
ensureWriteAccess(cuid, uid, action) helper.
   
   ### 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