New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best effort copying of run
directory
#2448
Best effort copying of run
directory
#2448
Conversation
🌐 Coverage report
|
if fl != nil { | ||
require.NoError(t, fl.Unlock()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe invoke this via a defer
so it will get executed even if the require.Equal
on the previous line fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (pending @cmacknz's review feedback).
This pull request is now in conflicts. Could you fix it? 🙏
|
What does this PR do?
This PR is using onErr hook provided by copy utility.
This onErr is raised whenever tool encounters an error, it's up to a caller to decide what to do with the error. In this PR we log error and return nil (swallowing the error) resulting in a copy process not being terminated.
onErr is a custom hook introuced in my own fork of the tool (hence replace in
go.mod
)I also opened a PR with this hook (fully tested) in copy repo: otiai10/copy#101
Once they decide to merge this we can remove our replace.
The other option was to perform copying by ourselves but the tool also handles symlinks and other edge cases already.
Unit tests for open handles also present.
Why is it important?
Prevents upgrade to fail on copy.
Checklist
./changelog/fragments
using the changelog toolFixes: #2433