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 7c06be3912
commit 88e8a3e5bc
1 changed files with 5 additions and 4 deletions

View File

@ -728,8 +728,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());
@ -738,7 +738,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) {
@ -750,7 +750,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));
}
}
}