mirror of
https://github.com/corda/corda.git
synced 2024-12-24 15:16:45 +00:00
CORDA-4026 Make early end session test not flakey (#6691)
This commit is contained in:
parent
64dc94bd18
commit
45fe3f3aef
node/src
main/kotlin/net/corda/node/services/statemachine/transitions
test/kotlin/net/corda/node/services/statemachine
@ -52,7 +52,7 @@ class StartedFlowTransition(
|
||||
is FlowIORequest.WaitForSessionConfirmations -> waitForSessionConfirmationsTransition()
|
||||
is FlowIORequest.ExecuteAsyncOperation<*> -> executeAsyncOperation(flowIORequest)
|
||||
FlowIORequest.ForceCheckpoint -> executeForceCheckpoint()
|
||||
}.let { scheduleTerminateSessionsIfRequired(it) }
|
||||
}.let { terminateSessionsIfRequired(it) }
|
||||
}
|
||||
|
||||
private fun waitForSessionConfirmationsTransition(): TransitionResult {
|
||||
@ -426,7 +426,7 @@ class StartedFlowTransition(
|
||||
|
||||
private fun collectEndedSessionErrors(sessionIds: Collection<SessionId>, checkpoint: Checkpoint): List<Throwable> {
|
||||
return sessionIds.filter { sessionId ->
|
||||
!checkpoint.checkpointState.sessions.containsKey(sessionId)
|
||||
sessionId !in checkpoint.checkpointState.sessions
|
||||
}.map {sessionId ->
|
||||
UnexpectedFlowEndException(
|
||||
"Tried to access ended session $sessionId",
|
||||
@ -525,7 +525,7 @@ class StartedFlowTransition(
|
||||
return builder { resumeFlowLogic(Unit) }
|
||||
}
|
||||
|
||||
private fun scheduleTerminateSessionsIfRequired(transition: TransitionResult): TransitionResult {
|
||||
private fun terminateSessionsIfRequired(transition: TransitionResult): TransitionResult {
|
||||
// If there are sessions to be closed, close them on the currently executing transition
|
||||
val sessionsToBeTerminated = findSessionsToBeTerminated(transition.newState)
|
||||
return if (sessionsToBeTerminated.isNotEmpty()) {
|
||||
|
@ -134,8 +134,8 @@ class RetryFlowMockTest {
|
||||
Assume.assumeTrue(!IS_OPENJ9)
|
||||
val partyB = nodeB.info.legalIdentities.first()
|
||||
assertThatExceptionOfType(UnexpectedFlowEndException::class.java).isThrownBy {
|
||||
nodeA.startFlow(UnbalancedSendAndReceiveFlow(partyB)).getOrThrow(20.seconds)
|
||||
}.withMessage("Received session end message instead of a data session message. Mismatched send and receive?")
|
||||
nodeA.startFlow(UnbalancedSendAndReceiveFlow(partyB)).getOrThrow(60.seconds)
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout=300_000)
|
||||
|
Loading…
Reference in New Issue
Block a user