test(common/auth): add spec for SessionUser#5788
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5788 +/- ##
============================================
- Coverage 53.30% 53.27% -0.04%
+ Complexity 2668 2665 -3
============================================
Files 1098 1098
Lines 42532 42532
Branches 4575 4575
============================================
- Hits 22673 22660 -13
- Misses 18530 18540 +10
- Partials 1329 1332 +3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 399 | 0.243 | 24,639/31,625/31,625 us | 🔴 +16.1% / 🟢 -9.6% |
| 🟢 | bs=100 sw=10 sl=64 | 798 | 0.487 | 124,785/136,631/136,631 us | 🟢 -7.0% / 🔴 +11.1% |
| ⚪ | bs=1000 sw=10 sl=64 | 919 | 0.561 | 1,093,236/1,146,102/1,146,102 us | ⚪ within ±5% / 🔴 +12.4% |
Baseline details
Latest main 731d671 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 399 tuples/sec | 428 tuples/sec | 410.82 tuples/sec | -6.8% | -2.9% |
| bs=10 sw=10 sl=64 | MB/s | 0.243 MB/s | 0.261 MB/s | 0.251 MB/s | -6.9% | -3.1% |
| bs=10 sw=10 sl=64 | p50 | 24,639 us | 21,228 us | 23,785 us | +16.1% | +3.6% |
| bs=10 sw=10 sl=64 | p95 | 31,625 us | 33,137 us | 34,980 us | -4.6% | -9.6% |
| bs=10 sw=10 sl=64 | p99 | 31,625 us | 33,137 us | 34,980 us | -4.6% | -9.6% |
| bs=100 sw=10 sl=64 | throughput | 798 tuples/sec | 830 tuples/sec | 891.94 tuples/sec | -3.9% | -10.5% |
| bs=100 sw=10 sl=64 | MB/s | 0.487 MB/s | 0.507 MB/s | 0.544 MB/s | -3.9% | -10.5% |
| bs=100 sw=10 sl=64 | p50 | 124,785 us | 120,027 us | 112,277 us | +4.0% | +11.1% |
| bs=100 sw=10 sl=64 | p95 | 136,631 us | 146,910 us | 139,802 us | -7.0% | -2.3% |
| bs=100 sw=10 sl=64 | p99 | 136,631 us | 146,910 us | 139,802 us | -7.0% | -2.3% |
| bs=1000 sw=10 sl=64 | throughput | 919 tuples/sec | 917 tuples/sec | 1,041 tuples/sec | +0.2% | -11.7% |
| bs=1000 sw=10 sl=64 | MB/s | 0.561 MB/s | 0.56 MB/s | 0.635 MB/s | +0.2% | -11.7% |
| bs=1000 sw=10 sl=64 | p50 | 1,093,236 us | 1,087,415 us | 972,714 us | +0.5% | +12.4% |
| bs=1000 sw=10 sl=64 | p95 | 1,146,102 us | 1,156,618 us | 1,023,057 us | -0.9% | +12.0% |
| bs=1000 sw=10 sl=64 | p99 | 1,146,102 us | 1,156,618 us | 1,023,057 us | -0.9% | +12.0% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,501.88,200,128000,399,0.243,24639.38,31624.51,31624.51
1,100,10,64,20,2504.73,2000,1280000,798,0.487,124785.49,136631.35,136631.35
2,1000,10,64,20,21771.56,20000,12800000,919,0.561,1093236.48,1146101.92,1146101.92There was a problem hiding this comment.
Pull request overview
Adds ScalaTest unit coverage in common-auth for SessionUser, ensuring its java.security.Principal contract and delegation behavior to the underlying jOOQ User POJO are pinned by tests.
Changes:
- Introduces
SessionUserSpeccovering delegation forgetName,getUid,getEmail,getGoogleId, andgetUser. - Adds role-check coverage for
isRoleOffor both matching (ADMIN) and non-matching (REGULARvsADMIN) cases.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
For PR description, use |
<!-- Thanks for sending a pull request (PR)! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: [Contributing to Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) 2. Ensure you have added or run the appropriate tests for your PR 3. If the PR is work in progress, mark it a draft on GitHub. 4. Please write your PR title to summarize what this PR proposes, we are following Conventional Commits style for PR titles as well. 5. Be sure to keep the PR description updated to reflect all changes. --> ### What changes were proposed in this PR? <!-- Please clarify what changes you are proposing. The purpose of this section is to outline the changes. Here are some tips for you: 1. If you propose a new API, clarify the use case for a new API. 2. If you fix a bug, you can clarify why it is a bug. 3. If it is a refactoring, clarify what has been changed. 3. It would be helpful to include a before-and-after comparison using screenshots or GIFs. 4. Please consider writing useful notes for better and faster reviews. --> Adds a unit test spec for `SessionUser`. Tests cover: - `getName` returns the wrapped `user.getName` (Principal contract) - `getUid`, `getEmail`, `getGoogleId` delegate to the wrapped User - `getUser` returns the same User instance - `isRoleOf(ADMIN)` returns `true` when role is ADMIN - `isRoleOf(ADMIN)` returns `false` when role is REGULAR Mirrors the existing `JwtParserSpec.scala` style (AnyFlatSpec with Matchers). ### Any related issues, documentation, discussions? <!-- Please use this section to link other resources if not mentioned already. 1. If this PR fixes an issue, please include `Fixes apache#1234`, `Resolves apache#1234` or `Closes apache#1234`. If it is only related, simply mention the issue number. 2. If there is design documentation, please add the link. 3. If there is a discussion in the mailing list, please add the link. --> Closes: apache#5779 ### How was this PR tested? <!-- If tests were added, say they were added here. Or simply mention that if the PR is tested with existing test cases. Make sure to include/update test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> Spec verified with `sbt "common-auth/testOnly *SessionUserSpec"`. 7 tests passing. ### Was this PR authored or co-authored using generative AI tooling? <!-- If generative AI tooling has been used in the process of authoring this PR, please include the phrase: 'Generated-by: ' followed by the name of the tool and its version. If no, write 'No'. Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details. --> Coauthored-by: Claude Code (Anthropic)
What changes were proposed in this PR?
Adds a unit test spec for
SessionUser. Tests cover:getNamereturns the wrappeduser.getName(Principal contract)getUid,getEmail,getGoogleIddelegate to the wrapped UsergetUserreturns the same User instanceisRoleOf(ADMIN)returnstruewhen role is ADMINisRoleOf(ADMIN)returnsfalsewhen role is REGULARMirrors the existing
JwtParserSpec.scalastyle (AnyFlatSpec with Matchers).Any related issues, documentation, discussions?
Closes: #5779
How was this PR tested?
Spec verified with
sbt "common-auth/testOnly *SessionUserSpec". 7 tests passing.Was this PR authored or co-authored using generative AI tooling?
Coauthored-by: Claude Code (Anthropic)