CORDA-1589 Flow hospital reports incorrect number of patients and fix… (#3315)

* CORDA-1589 Flow hospital reports incorrect number of patients and fix flakey associated test.

* Compare before and after count, not against zero.  There's a leak in killFlow that will be easier to address in or after Shams PR.
This commit is contained in:
Rick Parker 2018-06-07 09:12:25 +01:00 committed by GitHub
parent 0978d041a3
commit aa01ef638b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,7 @@ object StaffedFlowHospital : FlowHospital {
private val patients = ConcurrentHashMap<StateMachineRunId, MedicalHistory>()
val numberOfPatients = patients.size
val numberOfPatients get() = patients.size
class MedicalHistory {
val records: MutableList<Record> = mutableListOf()

View File

@ -89,8 +89,11 @@ class RetryFlowMockTest {
@Test
fun `Patient records do not leak in hospital`() {
val patientCountBefore = StaffedFlowHospital.numberOfPatients
assertEquals(Unit, internalNodeA.startFlow(RetryFlow(1)).get())
assertEquals(0, StaffedFlowHospital.numberOfPatients)
// Need to make sure the state machine has finished. Otherwise this test is flakey.
mockNet.waitQuiescent()
assertEquals(patientCountBefore, StaffedFlowHospital.numberOfPatients)
assertEquals(2, RetryFlow.count)
}
}