fix(metadata-collector): skip deleted pods during annotation updates - #1578
Conversation
Signed-off-by: Sarang Ravindra <tech.sarangravindra@gmail.com>
📝 WalkthroughWalkthroughThe mapper now treats Kubernetes ChangesPod Annotation Reconciliation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
metadata-collector/pkg/mapper/mapper_test.go (1)
355-355: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename the test to match the required pattern.
Use
TestUpdatePodDevicesAnnotations_DeletedPod_SkipsAndUpdatesExistingPod.As per coding guidelines, “Name tests descriptively following the pattern
TestFunctionName_Scenario_ExpectedBehaviorin Go.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@metadata-collector/pkg/mapper/mapper_test.go` at line 355, Rename the test function TestUpdatePodDevicesAnnotationsSkipsDeletedPod to TestUpdatePodDevicesAnnotations_DeletedPod_SkipsAndUpdatesExistingPod, preserving its existing test logic.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@metadata-collector/pkg/mapper/mapper_test.go`:
- Around line 355-398: Update TestUpdatePodDevicesAnnotationsSkipsDeletedPod and
its newTestDeviceMapper setup to use the repository’s envtest Kubernetes API
server instead of fake.NewSimpleClientset. Exercise the annotation update and
deleted-pod NotFound behavior through the real API server while preserving the
existing assertions for one update and the surviving pod’s annotation.
---
Nitpick comments:
In `@metadata-collector/pkg/mapper/mapper_test.go`:
- Line 355: Rename the test function
TestUpdatePodDevicesAnnotationsSkipsDeletedPod to
TestUpdatePodDevicesAnnotations_DeletedPod_SkipsAndUpdatesExistingPod,
preserving its existing test logic.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ca9d95e4-bd8a-4d8a-a396-2bbd83767db0
📒 Files selected for processing (2)
metadata-collector/pkg/mapper/mapper.gometadata-collector/pkg/mapper/mapper_test.go
|
/ok to test 5749789 |
|
🌿 Fern Docs Preview: https://nvidia-preview-pull-request-1578.docs.buildwithfern.com/nvsentinel |
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
|
/ok to test f7b76a6 |
|
Thanks @lalitadithya @XRFXLP 🙏🏼 |
Summary
This PR Fixes #1568. More specifically it:
UpdatePodDevicesAnnotationsinmetadata-collector/pkg/mapper/mapper.goto treatNotFoundresponses while patching Pod device annotations as a benign deletion race.Type of Change
Component(s) Affected
Testing
make lint-test-metadata-collector)Checklist
Summary by CodeRabbit
Bug Fixes
Tests