tysonnorris commented on a change in pull request #3812: ContainerClient + akka
http alternative to HttpUtils
URL:
https://github.com/apache/incubator-openwhisk/pull/3812#discussion_r204125226
##########
File path:
tests/src/test/scala/whisk/core/containerpool/docker/test/ApacheBlockingContainerClientTests.scala
##########
@@ -106,20 +113,41 @@ class ContainerConnectionTests
it should "handle empty entity response" in {
val timeout = 5.seconds
- val connection = new HttpUtils(hostWithPort, timeout, 1.B)
+ val connection = new ApacheBlockingContainerClient(hostWithPort, timeout,
1.B)
testStatusCode = 204
- val result = connection.post("/init", JsObject.empty, retry = true)
+ val result = Await.result(connection.post("/init", JsObject.empty, retry =
true), 10.seconds)
result shouldBe Left(NoResponseReceived())
}
+ it should "retry till timeout on HttpHostConnectException" in {
+ val timeout = 5.seconds
+ val badHostAndPort = "0.0.0.0:12345"
+ val connection = new ApacheBlockingContainerClient(badHostAndPort,
timeout, 1.B)
+ testStatusCode = 204
+ val start = Instant.now()
+ val result = Await.result(connection.post("/init", JsObject.empty, retry =
true), 10.seconds)
+ val end = Instant.now()
+ val waited = end.toEpochMilli - start.toEpochMilli
+ result should be('left)
+ result.left.get shouldBe a[Timeout]
+ result.left.get.asInstanceOf[Timeout].t shouldBe
a[RetryableConnectionError]
+ result.left.get
+ .asInstanceOf[Timeout]
+ .t
+ .asInstanceOf[RetryableConnectionError]
+ .t shouldBe a[HttpHostConnectException]
Review comment:
nice - much better! (worked for me)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services