Thank you, Arpit and Xuan.
The double tearDown is problematic, because it causes a race condition on trying to delete an open directory, ultimately failing the assertion in tearDown with "Cannot delete data-node dirs". This fails specifically on Windows because of its file locking policy.
The file in question is the same verification log mentioned in
HDFS-4274. The patch I uploaded there takes care of closing the file, but it happens in a separate thread started by DataBlockScanner. This is asynchronous of the main JUnit thread, so we don't know deterministically when the file will be closed.
For other tests, this has not been a problem. Presumably, that is because other tests consistently use MiniDFSCluster to manage this. TestBlockRecovery is a bit different in that most of its tests start a DataNode directly, but then testRaceBetweenReplicaRecoveryAndFinalizeBlock immediately shuts it down and uses a MiniDFSCluster instead.