cocoatestingfilesystemsintegration-testingmacfuse

How to test whether application handles slow/flaky filesystems properly?


I want to ensure that my application doesn't have any UI freezes when working on files on slow filesystem (e.g. networked, CD/DVD or spun-down HDD).

I'm using Cocoa filesystem operations directly. I'm afraid it would be too much effort to mock or abstract all of it just for testing, and besides there could be non-obvious ways in which my program touches filesystem.

I've tried using network drives for testing, but OS caching makes tests non-repeatable and... too fast :)

Is there something like deliberately slow MacFuse filesystem? Some other method that would let me find all UI hiccups and race conditions caused by unexpected delays?


Solution

  • The easiest answer is MacFUSE as noted elsewhere; that's pretty easy to simulate. You could also try mounting a share over NFS and then use bit throttling it using the built-in ipfw, like:

    ipfw pipe 1 config 1KByte/s ipfw add 1 pipe 1 src-port 2049

    or if you're using WebDAV

    ipfw add 1 pipe 1 src-port 80

    This will then drip-feed the requests through at whatever pipe level you've defined. You should be able to get rid of it again afterwards with:

    ipfw delete 1