Github user anmolnar commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/450#discussion_r162946298
--- Diff:
src/java/test/org/apache/zookeeper/server/persistence/FileTxnSnapLogTest.java
---
@@ -159,4 +159,222 @@ public void onTxnLoaded(TxnHeader hdr, Record rec) {
}
}
}
+
+ @Test
+ public void testDirCheckWithCorrectFiles() throws IOException {
+ File tmpDir = ClientBase.createEmptyTestDir();
+ File logDir = new File(tmpDir, "logdir");
+ File snapDir = new File(tmpDir, "snapdir");
+ File logVersionDir = new File(logDir, FileTxnSnapLog.version +
FileTxnSnapLog.VERSION);
+ File snapVersionDir = new File(snapDir, FileTxnSnapLog.version +
FileTxnSnapLog.VERSION);
+
+ if (!logVersionDir.exists()) {
+ logVersionDir.mkdirs();
+ }
+ if (!snapVersionDir.exists()) {
+ snapVersionDir.mkdirs();
+ }
+
+ Assert.assertTrue(logVersionDir.exists());
+ Assert.assertTrue(snapVersionDir.exists());
--- End diff --
These assert will never fail. mkdirs() throws exception if the directory
cannot be created.
---