TestNameNodeMetrics fails on Windows
This is because in testVolumeFailures, it tries to call DataNodeTestUtils.injectDataDirFailure on a volume folder. What injectDataDirFailure does is actually modifying the folder name from volume_name to volume_name.origin and create a new file named as volume_name. Inside the folder, it has two things: 1. a directory named as "current", 2. a file named as "in_use.lock". Windows behaves different from Linux when renaming the parent folder of a locked file. Windows prevent you from renaming while Linux allows.
So in order to inject data failure on to the volume. Instead of renaming the volume folder itself. Rename the folder inside it which doesn't hold a lock. Since the folder inside the volume is "current". Then we only need to inject data failure to volume_name/current.
- is related to
HADOOP-15475 Fix broken unit tests on Windows