refactor(orc8r): split function SetIdentityFromContext in middleware
Summary
Refactor parts of the function SetIdentityFromContext in orc8r middleware to separate functions to increase readability.
A Test for the function has also been created. The test cases are oriented by
- the possible cases described in the comment at the start of the function
- additional possible cases given in the code
The tests were first benchmarked on the original logic to ensure the refactoring did not change any potential outcome.


Test Plan
Run unit tests and newly created test to ensure the same outcomes as before the refactoring.
Additional Information
Created in pairing with @MoritzThomasHuebner
- [ ] This change is backwards-breaking
Thanks for opening a PR! :100:
- All commits must be signed off. This is enforced by
DCO check. - All PR titles must follow the semantic commits format. This is enforced by
Semantic PR.
Howto
- Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
- Checks. All required CI checks must pass before merge.
-
Merge. Once approved and passing CI checks, use the
ready2mergelabel to indicate the maintainers can merge your PR.
More info
Please take a moment to read through the Magma project's
- Contributing Conventions for norms around contributed code
If this is your first Magma PR, also consider reading
- Developer Onboarding for onboarding as a new Magma developer
- Development Workflow for guidance on your first pull request
- CI Checks for points of contact for failing or flaky CI checks
- GitHub-to-Slack mappings for Magma maintainers for guidance on how to contact maintainers on Slack
feg-workflow
2 files 203 suites 40s :stopwatch: 374 tests 374 :heavy_check_mark: 0 :zzz: 0 :x: 388 runs 388 :heavy_check_mark: 0 :zzz: 0 :x:
Results for commit 0d6f21fe.
:recycle: This comment has been updated with latest results.
dp-workflow
13 tests 13 :heavy_check_mark: 2m 46s :stopwatch: 1 suites 0 :zzz: 1 files 0 :x:
Results for commit 0d6f21fe.
:recycle: This comment has been updated with latest results.
cloud-workflow
1 010 tests 1 010 :heavy_check_mark: 2m 53s :stopwatch: 356 suites 0 :zzz: 7 files 0 :x:
Results for commit 0d6f21fe.
:recycle: This comment has been updated with latest results.
agw-workflow
615 tests 611 :heavy_check_mark: 3m 49s :stopwatch: 2 suites 4 :zzz: 2 files 0 :x:
Results for commit 0d6f21fe.
:recycle: This comment has been updated with latest results.
Hi @emakeev, could you please take another look at this if you get the chance to see whether the updates have addressed your comments? Thanks!
Hi @emakeev, could you please take another look at this if you get the chance to see whether the updates have addressed your comments? Thanks!