Skip to content

Commit

Permalink
HDFS-13681. Fix TestStartup.testNNFailToStartOnReadOnlyNNDir test fai…
Browse files Browse the repository at this point in the history
…lure on Windows. Contributed by Xiao Liang.

(cherry picked from commit 8762e9c)
  • Loading branch information
Inigo Goiri committed Jun 15, 2018
1 parent 0c1c26a commit f7a8717
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ public void testNNFailToStartOnReadOnlyNNDir() throws Exception {
assertTrue(nnDirs.iterator().hasNext());
assertEquals(
"NN dir should be created after NN startup.",
nnDirStr,
nnDirs.iterator().next().getPath());
new File(nnDirStr),
new File(nnDirs.iterator().next().getPath()));
final File nnDir = new File(nnDirStr);
assertTrue(nnDir.exists());
assertTrue(nnDir.isDirectory());
Expand All @@ -699,7 +699,7 @@ public void testNNFailToStartOnReadOnlyNNDir() throws Exception {
/* set read only */
assertTrue(
"Setting NN dir read only should succeed.",
nnDir.setReadOnly());
FileUtil.setWritable(nnDir, false));
cluster.restartNameNodes();
fail("Restarting NN should fail on read only NN dir.");
} catch (InconsistentFSStateException e) {
Expand All @@ -711,7 +711,8 @@ public void testNNFailToStartOnReadOnlyNNDir() throws Exception {
"storage directory does not exist or is not accessible."))));
} finally {
/* set back to writable in order to clean it */
assertTrue("Setting NN dir should succeed.", nnDir.setWritable(true));
assertTrue("Setting NN dir should succeed.",
FileUtil.setWritable(nnDir, true));
}
}
}
Expand Down

0 comments on commit f7a8717

Please sign in to comment.