[TASK] Fix unit test side effects
The CacheFactoryTest created directories in the distribution
root when run from there. Now it used a mocked filesystem.
The warnings about chmod() seem to be unavoidable, some
comments about that were added to the affected test.