borg icon indicating copy to clipboard operation
borg copied to clipboard

Automated tests for behaviour on I/O errors

Open c4rlo opened this issue 9 years ago • 2 comments

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.

c4rlo avatar Aug 22 '16 21:08 c4rlo

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.

PlasmaPower avatar Aug 22 '16 21:08 PlasmaPower

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

enkore avatar Aug 22 '16 21:08 enkore