From 66f241efe803639a3ad7a93f5d8ba4bb1de2bb00 Mon Sep 17 00:00:00 2001 From: Dan Newton Date: Thu, 30 Apr 2020 10:18:45 +0100 Subject: [PATCH] CORDA-3291 Support for new flow sleep in mock networks (#6200) The new flow sleep made `NotaryWhitelistTests` flaky which highlighted an issue with the change to how a flow sleeps. Messages were being pumped while the flow was sleeping which lead to inconsistent behaviour. Messages are no longer pumped while a flow sleeps. --- .../net/corda/testing/node/internal/InternalMockNetwork.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt index 5cac265b8b..aea0e9d5d0 100644 --- a/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt +++ b/testing/node-driver/src/main/kotlin/net/corda/testing/node/internal/InternalMockNetwork.kt @@ -550,7 +550,11 @@ open class InternalMockNetwork(cordappPackages: List = emptyList(), return allActiveFlows.any { val flowState = it.snapshot().checkpoint.flowState - flowState is FlowState.Started && flowState.flowIORequest is FlowIORequest.ExecuteAsyncOperation + flowState is FlowState.Started && when (flowState.flowIORequest) { + is FlowIORequest.ExecuteAsyncOperation -> true + is FlowIORequest.Sleep -> true + else -> false + } } }