Node startup minor refactor (#4342)

* Slight refactor

* Move side effect out of method
This commit is contained in:
Anthony Keenan
2018-12-03 09:42:16 +00:00
committed by GitHub
parent 00865a9456
commit fab09c74d5
3 changed files with 10 additions and 14 deletions

View File

@ -121,14 +121,8 @@ class DriverTests {
baseDirectory
}
if ((baseDirectory / "process-id").exists()) {
// The addShutdownHook call doesn't reliably get called on Windows (even on graceful node shutdown), so at least check
// that the lock has been released, to make sure the node has been killed
val pidFile = (baseDirectory / "process-id").toFile()
val pidFileRw = RandomAccessFile(pidFile, "rw")
pidFileRw.channel.tryLock()
pidFileRw.close()
}
// Should be able to start another node up in that directory
assertThat(NodeStartup().isNodeRunningAt(baseDirectory)).isTrue()
}
@Test