Rushabh S Shah, the concern about namespace pollution is valid, but this is why the first line of each of the tests is to create a Path that is unique to the given test case and all subsequent operations occur under that Path. Especially given the error that Eric has posted, I don't think that is the issue.
The reason that cluster.restartNameNodes() is called, IIUC, is to initiate a check of the edit log to ensure that edits aren't corrupted as per the comment right above the call - previously the cluster was completely recreated after each test case so there would be no reason (in terms of cleaning) to restart the namenode at the end of the test. Pinging Jing Zhao to confirm.
Eric Badger, first off, good catch. Apologies for introducing this issue and thank you for helping to deal with it. Can we just change the calls to cluster.restartNameNodes() to cluster.restartNameNode(true)? There is only one NN in this test so we can just use the already-available method on MiniDFSCluster and keep the change local to the test itself.