Automated tests for behaviour on I/O errors
From what I can see of the test suite, there do not seem to be any tests verifying that borg won't corrupt a repository if an unexpected I/O error of some kind occurs.
It would be really good to have some tests like this.
See How SQLite Is Tested for an impressive description of how they do it – this would be a great ultimate goal.
Meanwhile, it shouldn't be too hard to replace current explicit calls to open() etc. with a VFS layer that can be used to inject arbitrary I/O errors during testing.
Meanwhile, it shouldn't be too hard to replace current explicit calls to open() etc. with a VFS layer that can be used to inject arbitrary I/O errors during testing.
With python, I'm pretty sure we can override the builtin open function. Worst case scenario we have to use LD_PRELOAD to override it at the C level. I'd prefer both of those to explicitly using a wrapped open function.
In master repository IO/output goes through SyncFile, which has a reduced set of operations, and is also easier to override. Reading is done via normal open().
Also interesting would be better tests of the RPC client/server IO and parsing code, esp. bad inputs etc. (server is untrusted).