markusthoemmes commented on a change in pull request #4403: Add detailed error
and reason information to status code
URL:
https://github.com/apache/incubator-openwhisk/pull/4403#discussion_r272063108
##########
File path:
tests/src/test/scala/org/apache/openwhisk/http/PoolingRestClientTests.scala
##########
@@ -138,12 +138,19 @@ class PoolingRestClientTests
}
it should "return a status code on request failure" in {
- val httpResponse = HttpResponse(NotFound)
+ val customStatusCodeNotFound = StatusCodes
Review comment:
As discussed in Slack, this does not actually test what you implemented. It
rather tests if a given statuscode is forwarded as is.
Rather, you should add the "Limit is too large.." string as a body to the
HttpResponse like so:
```scala
val httpResponse = HttpResponse(NotFound, entity = "Limit is too large, must
not exceed 268435456")
```
Then you run that through the PoolingRestClient as is, and in the end you
can check that the rest client did it's job to add that info to the StatusCode
**it** returns (not the one it got):
```scala
val reqResult = await(poolingRestClient.requestJson[JsObject](request))
reqResult shouldBe Left(NotFound)
reqResult.left.get.reason shouldBe s"${NotFound.reason} (details: Limit is
too large, must not exceed 268435456)"
```
You can potentially pull the fixed string into a `val body = "Limit is too
large, must not exceed 268435456"` and use it in both cases (HttpResponse
building and test check) accordingly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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