Address comments

This commit is contained in:
Andras Slemmer 2017-08-30 17:51:19 +01:00
parent 75cd76b09b
commit 9891fb58b0

View File

@ -114,7 +114,7 @@ class P2PMessagingTest : NodeBasedTest() {
send(msg, serviceAddress, retryId = request.sessionID) send(msg, serviceAddress, retryId = request.sessionID)
responseFuture responseFuture
} }
crashingNodes.firstRequestReceived.await() crashingNodes.firstRequestReceived.await(5, TimeUnit.SECONDS)
// The request wasn't successful. // The request wasn't successful.
assertThat(responseFuture.isDone).isFalse() assertThat(responseFuture.isDone).isFalse()
crashingNodes.ignoreRequests = false crashingNodes.ignoreRequests = false
@ -148,7 +148,7 @@ class P2PMessagingTest : NodeBasedTest() {
// Wait until the first request is received // Wait until the first request is received
crashingNodes.firstRequestReceived.await(5, TimeUnit.SECONDS) crashingNodes.firstRequestReceived.await(5, TimeUnit.SECONDS)
// Stop alice's node before the request is redelivered the first request is ignored // Stop alice's node after we ensured that the first request was delivered and ignored.
alice.stop() alice.stop()
val numberOfRequestsReceived = crashingNodes.requestsReceived.get() val numberOfRequestsReceived = crashingNodes.requestsReceived.get()
assertThat(numberOfRequestsReceived).isGreaterThanOrEqualTo(1) assertThat(numberOfRequestsReceived).isGreaterThanOrEqualTo(1)
@ -159,7 +159,7 @@ class P2PMessagingTest : NodeBasedTest() {
val aliceRestarted = startNode(ALICE.name, configOverrides = mapOf("messageRedeliveryDelaySeconds" to 1)).getOrThrow() val aliceRestarted = startNode(ALICE.name, configOverrides = mapOf("messageRedeliveryDelaySeconds" to 1)).getOrThrow()
val response = aliceRestarted.network.onNext<Any>(dummyTopic, sessionId).getOrThrow(5.seconds) val response = aliceRestarted.network.onNext<Any>(dummyTopic, sessionId).getOrThrow(5.seconds)
assertThat(crashingNodes.requestsReceived.get()).isGreaterThanOrEqualTo(numberOfRequestsReceived + 1) assertThat(crashingNodes.requestsReceived.get()).isGreaterThan(numberOfRequestsReceived)
assertThat(response).isEqualTo(responseMessage) assertThat(response).isEqualTo(responseMessage)
} }