Reputation: 536
I'm trying to test some file io and I was wondering if there's a way to emulate the following situation:
I have a block-storage device that is constantly being read/written from, but I want to notify the users of the proper error when they are trying to read/write from a file stored in the block-storage device but the block-storage service/device becomes unavailable or detached mid write. In which case, the read or write command would "timeout," or "hang."
I'm trying to write a test case that reads a file and I want to emulate that situation as closely as possible, meaning I don't want to use signal
or just some timeout, I want to be able to make some kind of file that will hang a python file.read()
statement or a file.write()
statement.
Is this possible? I'm testing on a linux machine and mounting a blockstorage to a folder, pretty simple.
Upvotes: 2
Views: 481
Reputation: 356
It seems to me that fsdisk is the right tool your looking for. It can bind your storage and inject errors.
Upvotes: 1