test: Isolate wizard config files - #5207
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (52)
|
| Layer / File(s) | Summary |
|---|---|
Temporary root assignment and test validation cli/wizard/utils_test.go |
setConfigValueForTest uses t.TempDir() for an empty RootDir. The test verifies that config.yaml is created under the temporary root. |
Estimated code review effort: 2 (Simple) | ~5 minutes
Merge Risk: ⚪ Minimal · up to ac84c
This change isolates wizard test configuration in automatically cleaned temporary directories without affecting production behavior or dependencies; no actionable merge-blocking risk remains after normal checks and review.
Assessment Against Linked Issues
| Objective | Addressed | Explanation |
|---|---|---|
Use a temporary directory for test configuration writes [#4682] |
✅ |
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
- Create stacked PR
- Commit on current branch
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 @coderabbitai help to get the list of available commands.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5207 +/- ##
===========================================
+ Coverage 76.39% 76.45% +0.06%
===========================================
Files 647 647
Lines 51690 51690
===========================================
+ Hits 39486 39517 +31
+ Misses 8874 8852 -22
+ Partials 3330 3321 -9
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
islamaliev
left a comment
There was a problem hiding this comment.
The fix is legit but the test coverage gives me mixed feelings
| func TestSetConfigValueForTestUsesTemporaryRoot(t *testing.T) { | ||
| ctx := &WizardContext{} | ||
| setConfigValueForTest(t, ctx, "keyring.namespace", "test") | ||
|
|
||
| if _, err := os.Stat(filepath.Join(ctx.RootDir, "config.yaml")); err != nil { | ||
| t.Fatalf("expected config in temporary root: %v", err) | ||
| } | ||
| } |
There was a problem hiding this comment.
suggestion: you cover with tests and internal helper function for tests. This looks unconventional. I'd remove it
ChrisBQu
left a comment
There was a problem hiding this comment.
LGTM. Thanks for this.
Relevant issue(s)
Resolves #4682
Description
Makes the shared wizard test helper assign a temporary root directory whenever a test context does not provide one. This prevents configuration reads and writes from creating
config.yamlin the package checkout.Adds a regression test for the temporary-root fallback. Production behavior and dependencies are unchanged.
Tasks
How has this been tested?
go test ./cli/wizard -run TestSetConfigValueForTestUsesTemporaryRoot -count=1go test ./cli/wizard -skip SystemKeyring -count=1config.yamlin the worktreeTested on macOS.