🧪 [MTA-861] add tier1 offline validate coverage for empty A…#596
🧪 [MTA-861] add tier1 offline validate coverage for empty A…#596msajidmansoori12 wants to merge 2 commits into
Conversation
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new tier1 e2e test file for MTA-861 covering offline ChangesOffline empty API resources tests
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
🧹 Nitpick comments (1)
e2e-tests/tests/tier1/mta_861_validate_offline_empty_api_resources_test.go (1)
19-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract duplicated test setup into a shared helper.
The tempDir/inputDir/validateDir setup, golden manifest copy, and
CraneRunnerconstruction are duplicated almost verbatim across both specs. Consolidating into a helper (e.g.setupOfflineValidateFixture(tempDir string) (inputDir, validateDir string)) would reduce drift risk when this fixture setup needs to change.♻️ Suggested refactor
+func setupOfflineValidateFixture(tempDir string) (inputDir, validateDir string) { + inputDir = filepath.Join(tempDir, "input") + validateDir = filepath.Join(tempDir, "validate") + Expect(os.MkdirAll(inputDir, 0o755)).NotTo(HaveOccurred()) + + goldenOutputDir, err := utils.GoldenManifestsDir("simple-nginx-nopv", "output") + Expect(err).NotTo(HaveOccurred()) + sourceManifestPath := filepath.Join(goldenOutputDir, "output.yaml") + Expect(sourceManifestPath).To(BeAnExistingFile()) + + manifestData, err := os.ReadFile(sourceManifestPath) + Expect(err).NotTo(HaveOccurred()) + Expect(os.WriteFile(filepath.Join(inputDir, "output.yaml"), manifestData, 0o644)).NotTo(HaveOccurred()) + return inputDir, validateDir +}As per coding guidelines,
**/*_test.gofiles should "Use table-driven tests for multiple scenarios in Go test code"; consolidating the shared boilerplate moves closer to that intent even within a Ginkgo BDD structure.Also applies to: 68-110
🤖 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/tests/tier1/mta_861_validate_offline_empty_api_resources_test.go` around lines 19 - 51, The offline validate specs duplicate the same fixture setup, so extract the shared tempDir/inputDir/validateDir creation, golden manifest copy, API resources file setup, and CraneRunner construction into a helper such as setupOfflineValidateFixture used by both examples in the test file. Keep the helper returning the prepared directories and runner so each spec only defines its scenario-specific inputs and assertions. This will reduce drift between the two Validate test cases and make future fixture changes centralized.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.
Nitpick comments:
In `@e2e-tests/tests/tier1/mta_861_validate_offline_empty_api_resources_test.go`:
- Around line 19-51: The offline validate specs duplicate the same fixture
setup, so extract the shared tempDir/inputDir/validateDir creation, golden
manifest copy, API resources file setup, and CraneRunner construction into a
helper such as setupOfflineValidateFixture used by both examples in the test
file. Keep the helper returning the prepared directories and runner so each spec
only defines its scenario-specific inputs and assertions. This will reduce drift
between the two Validate test cases and make future fixture changes centralized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e11c1035-cf5d-4a71-a2e3-f35820c94bc4
📒 Files selected for processing (1)
e2e-tests/tests/tier1/mta_861_validate_offline_empty_api_resources_test.go
Signed-off-by: M Sajid Mansoori <mmansoor@redhat.com>
|
/rfr |
…PI resources
Summary by CodeRabbit