Tests now fail if spawned processes take too long to finish.

This commit is contained in:
Clinton Alexander 2016-06-17 11:01:09 +01:00 committed by Andras Slemmer
parent 9a2a7165a5
commit ad45b5deaf
3 changed files with 7 additions and 4 deletions

1
.idea/modules.xml generated
View File

@ -22,6 +22,7 @@
<module fileurl="file://$PROJECT_DIR$/.idea/modules/node/node_test.iml" filepath="$PROJECT_DIR$/.idea/modules/node/node_test.iml" group="node" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/r3prototyping.iml" filepath="$PROJECT_DIR$/.idea/modules/r3prototyping.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/r3prototyping_integrationTest.iml" filepath="$PROJECT_DIR$/.idea/modules/r3prototyping_integrationTest.iml" group="r3prototyping" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/r3prototyping_integrationTest.iml" filepath="$PROJECT_DIR$/.idea/modules/r3prototyping_integrationTest.iml" group="r3prototyping" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/r3prototyping_main.iml" filepath="$PROJECT_DIR$/.idea/modules/r3prototyping_main.iml" group="r3prototyping" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/r3prototyping_test.iml" filepath="$PROJECT_DIR$/.idea/modules/r3prototyping_test.iml" group="r3prototyping" />
</modules>

View File

@ -6,6 +6,7 @@ import kotlin.test.assertEquals
import org.junit.Test
import java.nio.file.Path
import java.nio.file.Paths
import java.util.concurrent.TimeUnit
class IRSDemoTest {
@Test fun `runs IRS demo`() {
@ -31,7 +32,7 @@ class IRSDemoTest {
private fun setupNode(dir: Path, nodeType: String) {
val args = listOf("--role", "Setup" + nodeType, "--dir", dir.toString())
val proc = spawn("com.r3corda.demos.IRSDemoKt", args)
proc.waitFor();
assertEquals(proc.waitFor(30, TimeUnit.SECONDS), true);
assertEquals(proc.exitValue(), 0)
}
@ -45,14 +46,14 @@ private fun startNode(dir: Path, nodeType: String, nodeAddr: String): Process {
private fun runTrade() {
val args = listOf("--role", "Trade", "trade1")
val proc = spawn("com.r3corda.demos.IRSDemoKt", args)
proc.waitFor();
assertEquals(proc.waitFor(30, TimeUnit.SECONDS), true);
assertEquals(proc.exitValue(), 0)
}
private fun runDateChange() {
val args = listOf("--role", "Date", "2017-01-02")
val proc = spawn("com.r3corda.demos.IRSDemoKt", args)
proc.waitFor();
assertEquals(proc.waitFor(30, TimeUnit.SECONDS), true);
assertEquals(proc.exitValue(), 0)
}

View File

@ -4,6 +4,7 @@ import com.r3corda.core.testing.utilities.spawn
import com.r3corda.core.testing.utilities.waitForNodeStartup
import org.junit.Test
import java.nio.file.Paths
import java.util.concurrent.TimeUnit
import kotlin.test.assertEquals
class TraderDemoTest {
@ -29,7 +30,7 @@ private fun runBuyer(): Process {
private fun runSeller() {
val args = listOf("--role", "SELLER")
val proc = spawn("com.r3corda.demos.TraderDemoKt", args)
proc.waitFor();
assertEquals(proc.waitFor(30, TimeUnit.SECONDS), true);
assertEquals(proc.exitValue(), 0)
}