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

   ### What changes were proposed in this PR?
   This PR expands test coverage for ComputingUnitAccessResource. #6446 
introduced ComputingUnitAccessResourceSpec but scoped it to 
grantAccess/revokeAccess; the rest of the resource was only exercised 
incidentally. This adds direct coverage for the remaining surface, all backed 
by embedded Postgres via MockTexeraDB:
   
   getComputingUnitAccessList: empty list, and multiple grantees with correct 
email / name / privilege mapping.
   Privilege helpers (companion object): isOwner (owner / non-owner / 
nonexistent cuid), getPrivilege (no grant -> null, granted -> value), and 
hasReadAccess / hasWriteAccess across owner, READ-grantee, WRITE-grantee, and 
no-grant users.
   getOwner: happy path (returns the owner's email). The nonexistent-unit -> 
404 case is already covered by #6475.
   Sharing-disabled branch: a new ComputingUnitAccessSharingDisabledSpec 
asserting every endpoint returns 403 (ForbiddenException) when sharing is off.
   No production code changes: test-only, plus one build.sbt test-config change 
described below.
   
   ### Any related issues, documentation, discussions?
   Closes #6490. Builds on the test infrastructure added in #6446 and the 
getOwner 404 fix in #6475.
   
   ### How was this PR tested?
   sbt "ComputingUnitManagingService/test": 40 tests across all 6 module suites 
pass; no existing suite regressed.
   
   The sharing-disabled path needs special handling: 
ComputingUnitConfig.sharingComputingUnitEnabled is resolved once as a load-time 
val from the COMPUTING_UNIT_SHARING_ENABLED env var, and the module's test JVM 
sets it to true (needed by the sharing-enabled suites). So the disabled branch 
can only be exercised in a JVM where that var is absent. To do that without 
disturbing the other suites, build.sbt adds a Test / testGrouping that keeps 
all sharing-enabled suites in the existing single forked JVM and isolates any 
*SharingDisabledSpec into its own forked JVM with the env var removed. Each 
spec asserts the resolved flag (sharingComputingUnitEnabled shouldBe true / 
false) as a first case, so a misconfigured grouping fails loudly instead of 
silently passing.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   Co-authored with Claude Opus 4.8 in compliance with ASF.
   
   


-- 
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