CORDA-4026 Make early end session test not flakey ()

This commit is contained in:
Dan Newton 2020-09-07 16:23:37 +01:00 committed by GitHub
parent 64dc94bd18
commit 45fe3f3aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions
node/src
main/kotlin/net/corda/node/services/statemachine/transitions
test/kotlin/net/corda/node/services/statemachine

View File

@ -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()) {

View File

@ -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)