test(device): add unit tests for DeviceInfo DeepCopy and DeepCopyDeviceInfos - #2972
test(device): add unit tests for DeviceInfo DeepCopy and DeepCopyDeviceInfos#2972Norway-02 wants to merge 1 commit into
Conversation
…ceInfos Signed-off-by: Norway-02 <anshulkhetade02@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Norway-02 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds tests for ChangesDeep Copy Test Coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds device deep-copy test coverage without altering runtime behavior. The tested copy and slice contracts are covered with no remaining merge-readiness risk. Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2⚔️ Resolve merge conflicts 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Adds table-driven unit tests
TestDeviceInfoDeepCopyandTestDeepCopyDeviceInfosinpkg/device/devices_test.goto test the deep copy implementations ofDeviceInfoand[]DeviceInfo.Specifically, these tests verify:
DeviceInfo.DeepCopy(). creates independent copies of all nested collections (MIGTemplate,CustomInfo,DevicePairScore.Scores).DeviceInfodoes NOT mutate the originalDeviceInfo.DeepCopyDeviceInfos()correctly handlesnil, empty slices, and multi-element slices with deep memory isolation.Follows the unit testing precedent established in maintainer PR #2825.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
All unit tests pass with race detection (
go test -race ./pkg/device), and license/import-alias checks (make verify) pass cleanly.Does this PR introduce a user-facing change?:
No.
Summary by CodeRabbit