Skip to content

Conversation

@jsas4coding
Copy link
Owner

No description provided.

@jsas4coding jsas4coding requested a review from Copilot June 8, 2025 16:42
@jsas4coding jsas4coding self-assigned this Jun 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

@jsas4coding jsas4coding merged commit a130e8c into main Jun 8, 2025
2 checks passed
@jsas4coding jsas4coding deleted the updates/fs-tests branch June 8, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants