mirror of
https://github.com/corda/corda.git
synced 2025-01-29 15:43:55 +00:00
Use FlowTimeOut exception rather than SQL deadlock in unit tests to avoid hitting the exponential back-off. (#4527)
This commit is contained in:
parent
60388a7a45
commit
b5fc095288
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -44,6 +44,8 @@
|
|||||||
<module name="corda-core_integrationTest" target="1.8" />
|
<module name="corda-core_integrationTest" target="1.8" />
|
||||||
<module name="corda-core_smokeTest" target="1.8" />
|
<module name="corda-core_smokeTest" target="1.8" />
|
||||||
<module name="corda-finance_integrationTest" target="1.8" />
|
<module name="corda-finance_integrationTest" target="1.8" />
|
||||||
|
<module name="corda-isolated_main" target="1.8" />
|
||||||
|
<module name="corda-isolated_test" target="1.8" />
|
||||||
<module name="corda-project_buildSrc_main" target="1.8" />
|
<module name="corda-project_buildSrc_main" target="1.8" />
|
||||||
<module name="corda-project_buildSrc_test" target="1.8" />
|
<module name="corda-project_buildSrc_test" target="1.8" />
|
||||||
<module name="corda-project_canonicalizer_main" target="1.8" />
|
<module name="corda-project_canonicalizer_main" target="1.8" />
|
||||||
|
@ -16,6 +16,7 @@ import net.corda.core.utilities.ProgressTracker
|
|||||||
import net.corda.core.utilities.getOrThrow
|
import net.corda.core.utilities.getOrThrow
|
||||||
import net.corda.core.utilities.unwrap
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.node.services.Permissions
|
import net.corda.node.services.Permissions
|
||||||
|
import net.corda.node.services.statemachine.FlowTimeoutException
|
||||||
import net.corda.testing.core.ALICE_NAME
|
import net.corda.testing.core.ALICE_NAME
|
||||||
import net.corda.testing.core.BOB_NAME
|
import net.corda.testing.core.BOB_NAME
|
||||||
import net.corda.testing.core.singleIdentity
|
import net.corda.testing.core.singleIdentity
|
||||||
@ -117,8 +118,6 @@ fun isQuasarAgentSpecified(): Boolean {
|
|||||||
return jvmArgs.any { it.startsWith("-javaagent:") && it.contains("quasar") }
|
return jvmArgs.any { it.startsWith("-javaagent:") && it.contains("quasar") }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExceptionToCauseRetry : SQLException("deadlock")
|
|
||||||
|
|
||||||
class ExceptionToCauseFiniteRetry : ConstraintViolationException("Faked violation", SQLException("Fake"), "Fake name")
|
class ExceptionToCauseFiniteRetry : ConstraintViolationException("Faked violation", SQLException("Fake"), "Fake name")
|
||||||
|
|
||||||
@StartableByRPC
|
@StartableByRPC
|
||||||
@ -135,7 +134,7 @@ class InitiatorFlow(private val sessionsCount: Int, private val iterationsCount:
|
|||||||
val visited = Visited(sessionNum, iterationNum, step)
|
val visited = Visited(sessionNum, iterationNum, step)
|
||||||
if (visited !in seen) {
|
if (visited !in seen) {
|
||||||
seen += visited
|
seen += visited
|
||||||
throw ExceptionToCauseRetry()
|
throw FlowTimeoutException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +185,7 @@ class InitiatedFlow(val session: FlowSession) : FlowLogic<Any>() {
|
|||||||
val visited = Visited(sessionNum, iterationNum, step)
|
val visited = Visited(sessionNum, iterationNum, step)
|
||||||
if (visited !in seen) {
|
if (visited !in seen) {
|
||||||
seen += visited
|
seen += visited
|
||||||
throw ExceptionToCauseRetry()
|
throw FlowTimeoutException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user