From 2459530a141e97afcc21c1e66ca6c185ce7352f1 Mon Sep 17 00:00:00 2001 From: Kyriakos Tharrouniatis Date: Tue, 18 Feb 2020 14:06:16 +0000 Subject: [PATCH] Add timeout to tests --- .../vault/VaultObserverExceptionTest.kt | 14 ++++++------- .../corda/node/utilities/ObservablesTests.kt | 20 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt b/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt index a38b925316..65e27ae178 100644 --- a/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/services/vault/VaultObserverExceptionTest.kt @@ -106,7 +106,7 @@ class VaultObserverExceptionTest { * Causing an SqlException via a syntax error in a vault observer causes the flow to hit the * DatabsaseEndocrinologist in the FlowHospital and being kept for overnight observation - Unsafe subscribe */ - @Test + @Test(timeout=300_000) fun unhandledSqlExceptionFromVaultObserverGetsHospitalised_UnsafeSubscription() { DbListenerService.safeSubscription = false val testControlFuture = openFuture().toCompletableFuture() @@ -428,7 +428,7 @@ class VaultObserverExceptionTest { * * This test causes 2 failures inside of the observer to ensure that the observer is still subscribed. */ - @Test + @Test(timeout=300_000) fun `Throw user error in VaultService rawUpdates during FinalityFlow blows up the flow but does not break the Observer - onNext check`() { var observationCounter = 0 StaffedFlowHospital.onFlowKeptForOvernightObservation.add { _, _ -> ++observationCounter } @@ -510,7 +510,7 @@ class VaultObserverExceptionTest { * * This test causes 2 failures inside of the observer to ensure that the observer is still subscribed. */ - @Test + @Test(timeout=300_000) fun `Throw user error in VaultService rawUpdates during FinalityFlow blows up the flow but does not break the Observer - onNext and onError check`() { var observationCounter = 0 StaffedFlowHospital.onFlowKeptForOvernightObservation.add { _, _ -> ++observationCounter } @@ -594,7 +594,7 @@ class VaultObserverExceptionTest { * * This test causes 2 failures inside of the observer to ensure that the observer is still subscribed. */ - @Test + @Test(timeout=300_000) fun `Throw user error in VaultService rawUpdates during counterparty FinalityFlow blows up the flow but does not break the Observer`() { var observationCounter = 0 StaffedFlowHospital.onFlowKeptForOvernightObservation.add { _, _ -> ++observationCounter } @@ -669,7 +669,7 @@ class VaultObserverExceptionTest { * * This test causes 2 failures inside of the [rx.Observer] to ensure that the Observer is still subscribed. */ - @Test + @Test(timeout=300_000) fun `Throw user error in VaultService rawUpdates during FinalityFlow blows up the flow but does not break the Observer`() { var observationCounter = 0 StaffedFlowHospital.onFlowKeptForOvernightObservation.add { _, _ -> ++observationCounter } @@ -736,7 +736,7 @@ class VaultObserverExceptionTest { } } - @Test + @Test(timeout=300_000) fun `Accessing NodeVaultService rawUpdates from a flow is not allowed` () { val user = User("user", "foo", setOf(Permissions.all())) driver(DriverParameters(startNodesInProcess = true, @@ -760,7 +760,7 @@ class VaultObserverExceptionTest { } } - @Test + @Test(timeout=300_000) fun `Failing Observer wrapped with FlowSafeSubscriber will survive and be re-called upon flow retry`() { var onNextCount = 0 var onErrorCount = 0 diff --git a/node/src/test/kotlin/net/corda/node/utilities/ObservablesTests.kt b/node/src/test/kotlin/net/corda/node/utilities/ObservablesTests.kt index 52ad90aba7..d29ce5ac9e 100644 --- a/node/src/test/kotlin/net/corda/node/utilities/ObservablesTests.kt +++ b/node/src/test/kotlin/net/corda/node/utilities/ObservablesTests.kt @@ -225,7 +225,7 @@ class ObservablesTests { assertEquals(2, count) } - @Test + @Test(timeout=300_000) fun `FlowSafeSubject subscribes by default FlowSafeSubscribers, wrapped Observers will survive errors from onNext`() { var heartBeat1 = 0 var heartBeat2 = 0 @@ -257,7 +257,7 @@ class ObservablesTests { assertEquals(2, heartBeat2) } - @Test + @Test(timeout=300_000) fun `FlowSafeSubject unsubscribes FlowSafeSubscribers only upon explicitly calling onError`() { var heartBeat = 0 val source = PublishSubject.create() @@ -272,7 +272,7 @@ class ObservablesTests { assertEquals(2, heartBeat) } - @Test + @Test(timeout=300_000) fun `FlowSafeSubject wrapped with a SafeSubscriber shuts down the whole structure, if one of them is unsafe and it throws`() { var heartBeat = 0 val source = PublishSubject.create() @@ -299,7 +299,7 @@ class ObservablesTests { * The reason why it should not call its onError is: if it wraps a [PublishSubject], calling [FlowSafeSubscriber.onError] * will then call [PublishSubject.onError] which will shut down all the subscribers under the [PublishSubject]. */ - @Test + @Test(timeout=300_000) fun `FlowSafeSubject wrapped with a FlowSafeSubscriber will preserve the structure, if one of them is unsafe and it throws`() { var heartBeat = 0 val source = PublishSubject.create() @@ -319,7 +319,7 @@ class ObservablesTests { assertEquals(3, heartBeat) } - @Test + @Test(timeout=300_000) fun `throwing inside onNext of a FlowSafeSubscriber leaf subscriber will call onError`() { var heartBeatOnNext = 0 var heartBeatOnError = 0 @@ -342,7 +342,7 @@ class ObservablesTests { * In this test FlowSafeSubscriber throws an OnNextFailedException which is a OnErrorNotImplementedException. * Because its underlying subscriber is not an ActionSubscriber, it will not be considered as a leaf FlowSafeSubscriber. */ - @Test + @Test(timeout=300_000) fun `throwing FlowSafeSubscriber at onNext will wrap with a Rx OnErrorNotImplementedException`() { val flowSafeSubscriber = FlowSafeSubscriber(Subscribers.create { throw IllegalStateException() }) assertFailsWith { // actually fails with an OnNextFailedException @@ -350,7 +350,7 @@ class ObservablesTests { } } - @Test + @Test(timeout=300_000) fun `throwing inside FlowSafeSubscriber onError will wrap with a Rx OnErrorFailedException`() { val flowSafeSubscriber = FlowSafeSubscriber( ActionSubscriber( @@ -372,7 +372,7 @@ class ObservablesTests { * it will throw a OnErrorNotImplementedException. Then it will be propagated back until FlowSafeSubscriber_X. * FlowSafeSubscriber_X will identify it is a not leaf subscriber and therefore will rethrow it as OnNextFailedException. */ - @Test + @Test(timeout=300_000) fun `propagated Rx exception will be rethrown at FlowSafeSubscriber onError`() { val source = PublishSubject.create() source.flowSafeSubscribe().subscribe { throw IllegalStateException("123") } // will give a leaf FlowSafeSubscriber @@ -385,7 +385,7 @@ class ObservablesTests { } } - @Test + @Test(timeout=300_000) fun `test flowSafeSubscribe strictMode = true replaces SafeSubscriber subclass`() { var heartBeat = 0 val customSafeSubscriber = CustomSafeSubscriber( @@ -402,7 +402,7 @@ class ObservablesTests { assertEquals(2, heartBeat) } - @Test + @Test(timeout=300_000) fun `test flowSafeSubscribe strictMode = false will not replace SafeSubscriber subclass`() { var heartBeat = 0 val customSafeSubscriber = CustomSafeSubscriber(