HDFS-13681. Fix TestStartup.testNNFailToStartOnReadOnlyNNDir test failure on Windows. Contributed by Xiao Liang.
(cherry picked from commit 8762e9cf10
)
This commit is contained in:
parent
7c06be3912
commit
88e8a3e5bc
|
@ -728,8 +728,8 @@ public class TestStartup {
|
||||||
assertTrue(nnDirs.iterator().hasNext());
|
assertTrue(nnDirs.iterator().hasNext());
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"NN dir should be created after NN startup.",
|
"NN dir should be created after NN startup.",
|
||||||
nnDirStr,
|
new File(nnDirStr),
|
||||||
nnDirs.iterator().next().getPath());
|
new File(nnDirs.iterator().next().getPath()));
|
||||||
final File nnDir = new File(nnDirStr);
|
final File nnDir = new File(nnDirStr);
|
||||||
assertTrue(nnDir.exists());
|
assertTrue(nnDir.exists());
|
||||||
assertTrue(nnDir.isDirectory());
|
assertTrue(nnDir.isDirectory());
|
||||||
|
@ -738,7 +738,7 @@ public class TestStartup {
|
||||||
/* set read only */
|
/* set read only */
|
||||||
assertTrue(
|
assertTrue(
|
||||||
"Setting NN dir read only should succeed.",
|
"Setting NN dir read only should succeed.",
|
||||||
nnDir.setReadOnly());
|
FileUtil.setWritable(nnDir, false));
|
||||||
cluster.restartNameNodes();
|
cluster.restartNameNodes();
|
||||||
fail("Restarting NN should fail on read only NN dir.");
|
fail("Restarting NN should fail on read only NN dir.");
|
||||||
} catch (InconsistentFSStateException e) {
|
} catch (InconsistentFSStateException e) {
|
||||||
|
@ -750,7 +750,8 @@ public class TestStartup {
|
||||||
"storage directory does not exist or is not accessible."))));
|
"storage directory does not exist or is not accessible."))));
|
||||||
} finally {
|
} finally {
|
||||||
/* set back to writable in order to clean it */
|
/* 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue