HDFS-13681. Fix TestStartup.testNNFailToStartOnReadOnlyNNDir test failure on Windows. Contributed by Xiao Liang.

(cherry picked from commit 8762e9cf10)
This commit is contained in:
Inigo Goiri 2018-06-15 16:49:06 -07:00
parent b52316d796
commit 9e148aa0bc
1 changed files with 5 additions and 4 deletions

View File

@ -689,8 +689,8 @@ public class TestStartup {
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());
@ -699,7 +699,7 @@ public class TestStartup {
/* 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) {
@ -711,7 +711,8 @@ public class TestStartup {
"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));
}
}
}