mirror of
https://github.com/corda/corda.git
synced 2025-01-18 02:39:51 +00:00
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:
parent
0978d041a3
commit
aa01ef638b
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user