Testdeletecontext fails#418
Conversation
Signed-off-by: ansita20 <ansitasingh20@gmail.com>
Signed-off-by: ansita20 <ansitasingh20@gmail.com>
|
Welcome to the Microcks community! 💖 Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly. Hope you have a great time there! |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR corrects typos in exported constructor names and improves path/test handling to make the CLI and watcher components more consistent and reliable.
Changes:
- Rename
NewCommad→NewCommandand update the entrypoint call site. - Rename
NewWatchManger→NewWatchManagerand update call sites. - Normalize import file paths earlier; make
TestDeleteContextwrite config into a per-test temp dir.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| watcher/main.go | Updates watcher manager constructor call to the corrected name. |
| pkg/watcher/watchManager.go | Renames exported constructor to NewWatchManager. |
| main.go | Updates CLI command constructor call to NewCommand. |
| cmd/import.go | Moves/expands path normalization before upload and watcher config updates. |
| cmd/context_test.go | Uses t.TempDir() for isolated config file creation in tests. |
| cmd/cmd.go | Renames exported CLI constructor to NewCommand. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Normalize file path to match the watcher fsnotify events format. | ||
| if strings.HasPrefix(f, "./") { | ||
| f = strings.TrimPrefix(f, "./") | ||
| } |
There was a problem hiding this comment.
the problem is that [string.HasPrefix(f,"./")] only matches POSIX ./ . it misses Windows .\ and doesn't normalize segments like foo/../bar or duplicate slashes so the fsnotify and other file APIs may produce paths with different separators or redundant segments. to fix this use [filepath.Clean] (OS-aware normalization) then trim a leading . + path separator.
| testConfigFilePath := filepath.Join(t.TempDir(), "local.config") | ||
|
|
||
| //write the test config file | ||
| err := os.WriteFile(testConfigFilePath, []byte(testConfig), os.ModePerm) |
…ain.go Signed-off-by: ansita20 <ansitasingh20@gmail.com>
9bf3e25 to
af23f9f
Compare
…e file mode Signed-off-by: ansita20 <ansitasingh20@gmail.com>
|
The minor changes in context_test.go are already included in PR #385, so it would be better to revert/drop those changes from this PR to avoid duplication. |
Oh ok thanks a lot I will be reverting these issues |
Signed-off-by: ansita20 <ansitasingh20@gmail.com>
Signed-off-by: ansita20 <ansitasingh20@gmail.com>
Summary
This PR fixes Issue #417 by removing the brittle relative path dependency in
TestDeleteContextand correcting a typo in the application entrypoint.Changes Made
Fixed entrypoint typo in
main.goChanged:
To:
Updated
cmd/context_test.goReplaced the hardcoded path:
With a temporary isolated file using:
Added the required
path/filepathimport.Verification
Created branch:
testdeletecontext-failsRan:
go test ./...All tests pass successfully.
Fixes #417