Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances fault injection in file system operations and updates associated tests to simulate various failure scenarios.
- Introduces a dependency injection mechanism (via the inj variable and injFunc struct) for deterministic fault simulation in FS functions.
- Refactors FS tests to reset injections before test execution and replaces older test names with more descriptive ones.
- Adds new test cases covering multiple error scenarios for directory moving and copying.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/fs/fs_test.go | Updated tests to utilize resetInjection, renamed subtests, and enhanced error simulation logic |
| internal/fs/fs.go | Introduced injFunc for dependency injection, refactored FS functions to use injected functions, and added safeClose |
Comments suppressed due to low confidence (2)
internal/fs/fs.go:32
- [nitpick] The variable name 'inj' is quite abbreviated and could be less clear to new maintainers; consider renaming it to a more descriptive identifier like 'injections'.
var inj = injFunc{
internal/fs/fs_test.go:72
- [nitpick] The error message in the subsequent test check ('expected non-regular file error') is somewhat ambiguous; consider clarifying it to better reflect the expected wrapped error content.
err := CopyFile(dirPath, "out")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.