Skip to content

Commit 589a0aa

Browse files
committed
add sleep on restart lock test as token loading is now async
1 parent 768a2b0 commit 589a0aa

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

freighter-tests/src/freighterTest/kotlin/freighter/testing/HugeTokensLoadedOnRestartTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import freighter.machine.generateRandomString
1515
import net.corda.core.contracts.Amount
1616
import net.corda.core.messaging.startFlow
1717
import net.corda.core.utilities.getOrThrow
18+
import org.junit.jupiter.api.Tag
1819
import org.junit.jupiter.api.Test
1920
import utility.getOrThrow
2021
import java.time.Duration
@@ -25,6 +26,10 @@ import java.util.stream.StreamSupport
2526
import kotlin.concurrent.withLock
2627
import kotlin.streams.toList
2728

29+
@Tag("LARGE_TEST")
30+
annotation class LargeTest
31+
32+
@LargeTest
2833
class HugeTokensLoadedOnRestartTest : DockerRemoteMachineBasedTest() {
2934

3035
val loadingThreads = 8

workflows-integration-test/src/integrationTest/kotlin/com/r3/corda/lib/tokens/integrationTest/TokenDriverTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,11 @@ class TokenDriverTest {
292292
listOf(50.USD issuedBy nodeParty heldBy nodeParty),
293293
emptyList<Party>()
294294
).returnValue.getOrThrow()
295-
// Run select and lock tokens flow with 5 seconds sleep in it.
295+
// Run select and lock tokens flow
296296
node.rpc.startFlowDynamic(
297297
SelectAndLockFlow::class.java,
298298
50.GBP,
299-
5.seconds
299+
50.seconds
300300
)
301301
// Stop node
302302
(node as OutOfProcess).process.destroyForcibly()
@@ -305,6 +305,8 @@ class TokenDriverTest {
305305
// Restart the node
306306
val restartedNode = startNode(providedName = DUMMY_BANK_A_NAME, customOverrides = mapOf("p2pAddress" to "localhost:30000")).getOrThrow()
307307
// Try to spend same states, they should be locked after restart, so we expect insufficient not locked balance exception to be thrown.
308+
Thread.sleep(15000) // because token loading is now async, we must wait a bit of time before we can attempt to select.
309+
308310
assertFailsWith<InsufficientNotLockedBalanceException> {
309311
restartedNode.rpc.startFlowDynamic(
310312
SelectAndLockFlow::class.java,

0 commit comments

Comments
 (0)