I tried to see why we failed to catch this in
MAPREDUCE-879. The core issue here is that there are two APIs in TestTaskTrackerLocalization - checkFilePermissions and setupPermissionScriptDir(File) which are related to each other. I.e. the former requires the latter to have been called. But they are static and thus hide this dependency. In the review, it didn't occur to me that I should check for callers of checkFilePermissions and verify this dependency is satisfied by other callers (like TestDebugScriptWithLinuxTaskController), as the API was not touched in the patch.
As a result of that, I am tending to think that others will make the same mistake in future as well. I.e, they may think there's no dependency between these APIs and call only checkFilePermissions without calling setupPermissionScriptDir.
So, though the attached patch actually fixes the issue for this test case, I would like to see an approach that goes beyond the fix and prevents these problems in future as well. Makes sense ?