mirror of
https://github.com/corda/corda.git
synced 2025-01-18 10:46:38 +00:00
disable multiprocess port allocation test on windows due to it being unable to handle long command lines (#5273)
This commit is contained in:
parent
22e4b8e962
commit
359552f30c
@ -35,46 +35,47 @@ class PortAllocationTest {
|
||||
|
||||
@Test(timeout = 120_000)
|
||||
fun `should support multiprocess port allocation`() {
|
||||
if (!System.getProperty("os.name").toLowerCase().contains("windows")) {
|
||||
println("Starting multiprocess port allocation test")
|
||||
val spinnerFile = Files.newTemporaryFile().also { it.deleteOnExit() }.absolutePath
|
||||
val process1 = buildJvmProcess(spinnerFile, 1)
|
||||
val process2 = buildJvmProcess(spinnerFile, 2)
|
||||
|
||||
println("Starting multiprocess port allocation test")
|
||||
val spinnerFile = Files.newTemporaryFile().also { it.deleteOnExit() }.absolutePath
|
||||
val process1 = buildJvmProcess(spinnerFile, 1)
|
||||
val process2 = buildJvmProcess(spinnerFile, 2)
|
||||
println("Started child processes")
|
||||
|
||||
println("Started child processes")
|
||||
val processes = listOf(process1, process2)
|
||||
|
||||
val processes = listOf(process1, process2)
|
||||
val spinnerBackingFile = RandomAccessFile(spinnerFile, "rw")
|
||||
println("Mapped spinner file")
|
||||
val spinnerBuffer = spinnerBackingFile.channel.map(FileChannel.MapMode.READ_WRITE, 0, 512)
|
||||
println("Created spinner buffer")
|
||||
|
||||
val spinnerBackingFile = RandomAccessFile(spinnerFile, "rw")
|
||||
println("Mapped spinner file")
|
||||
val spinnerBuffer = spinnerBackingFile.channel.map(FileChannel.MapMode.READ_WRITE, 0, 512)
|
||||
println("Created spinner buffer")
|
||||
var timeWaited = 0L
|
||||
|
||||
var timeWaited = 0L
|
||||
while (spinnerBuffer.getShort(1) != 10.toShort() && spinnerBuffer.getShort(2) != 10.toShort() && timeWaited < 60_000) {
|
||||
println("Waiting to childProcesses to report back. waited ${timeWaited}ms")
|
||||
Thread.sleep(1000)
|
||||
timeWaited += 1000
|
||||
}
|
||||
|
||||
while (spinnerBuffer.getShort(1) != 10.toShort() && spinnerBuffer.getShort(2) != 10.toShort() && timeWaited < 60_000) {
|
||||
println("Waiting to childProcesses to report back. waited ${timeWaited}ms")
|
||||
Thread.sleep(1000)
|
||||
timeWaited += 1000
|
||||
//GO!
|
||||
println("Instructing child processes to start allocating ports")
|
||||
spinnerBuffer.putShort(0, 8)
|
||||
println("Waiting for child processes to terminate")
|
||||
processes.forEach { it.waitFor(1, TimeUnit.MINUTES) }
|
||||
println("child processes terminated")
|
||||
|
||||
val process1Output = process1.inputStream.reader().readLines().toSet()
|
||||
val process2Output = process2.inputStream.reader().readLines().toSet()
|
||||
|
||||
println("child process out captured")
|
||||
|
||||
Assert.assertThat(process1Output.size, `is`(10_000))
|
||||
Assert.assertThat(process2Output.size, `is`(10_000))
|
||||
|
||||
//there should be no overlap between the outputs as each process should have been allocated a unique set of ports
|
||||
Assert.assertThat(process1Output.intersect(process2Output), `is`(emptySet()))
|
||||
}
|
||||
|
||||
//GO!
|
||||
println("Instructing child processes to start allocating ports")
|
||||
spinnerBuffer.putShort(0, 8)
|
||||
println("Waiting for child processes to terminate")
|
||||
processes.forEach { it.waitFor(1, TimeUnit.MINUTES) }
|
||||
println("child processes terminated")
|
||||
|
||||
val process1Output = process1.inputStream.reader().readLines().toSet()
|
||||
val process2Output = process2.inputStream.reader().readLines().toSet()
|
||||
|
||||
println("child process out captured")
|
||||
|
||||
Assert.assertThat(process1Output.size, `is`(10_000))
|
||||
Assert.assertThat(process2Output.size, `is`(10_000))
|
||||
|
||||
//there should be no overlap between the outputs as each process should have been allocated a unique set of ports
|
||||
Assert.assertThat(process1Output.intersect(process2Output), `is`(emptySet()))
|
||||
}
|
||||
|
||||
private fun buildJvmProcess(spinnerFile: String, reportingIndex: Int): Process {
|
||||
|
Loading…
Reference in New Issue
Block a user