🧪 Add e2e test for migrate namespace with multiple secret types#635
🧪 Add e2e test for migrate namespace with multiple secret types#635Tamar-Dinavetsky wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughAdds a reusable Kubernetes Secret verification helper and a tier1 end-to-end test covering creation, migration, application, and validation of Opaque, TLS, and docker-registry Secrets. ChangesSecret migration validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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 |
Test Coverage ReportTotal: 47.8% Per-package coverage
Full function-level detailsPosted by CI |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
e2e-tests/framework/test_helpers.go (1)
99-112: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
unstructured.Unstructuredfor this secret check Replace the manualmap[string]anydecode and type assertions withunstructured.Unstructuredplus the nested access helpers; it’s the idiomatic shape for dynamic Kubernetes objects and keeps the checks safer and clearer.🤖 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 `@e2e-tests/framework/test_helpers.go` around lines 99 - 112, Update the secret validation logic around the JSON decode to use an unstructured.Unstructured object instead of map[string]any. Reuse its nested access helpers to read and validate the type field and data contents, preserving the existing error behavior for invalid JSON, missing or mismatched types, and empty data.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 `@e2e-tests/framework/test_helpers.go`:
- Around line 93-118: Update VerifySecret so every error message includes the
Kubernetes secret namespace and secret name. For the type assertion and
expected-type mismatch checks, report the actual received value/type explicitly,
including when the field is missing or not a string, while preserving the
existing validation behavior and wrapped command/JSON errors.
---
Nitpick comments:
In `@e2e-tests/framework/test_helpers.go`:
- Around line 99-112: Update the secret validation logic around the JSON decode
to use an unstructured.Unstructured object instead of map[string]any. Reuse its
nested access helpers to read and validate the type field and data contents,
preserving the existing error behavior for invalid JSON, missing or mismatched
types, and empty data.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 65aef3e4-7fde-482e-bbdf-47774977aaa1
📒 Files selected for processing (2)
e2e-tests/framework/test_helpers.goe2e-tests/tests/tier1/mta_842_secrets_migration_test.go
|
Tested on OCP successfully. |
|
/rfr |
Summary
multiple types (Opaque, TLS, dockerconfigjson)
types intact
cluster
Test plan
Framework changes
verifies type and data fields
Polarion: MTA-842
#502
Summary by CodeRabbit