Improve akka http metrics tests (#15534)

Removes possible flakiness.
With chunked data, if the request is not executed, the request data might not be processed, and its size not recorded.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Luc Bourlier 2022-11-11 14:17:25 +01:00 committed by GitHub
parent da0f63d3f2
commit fb1c7e7c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -257,6 +257,7 @@ class AkkaHttpMetricsSpec extends AnyWordSpec with Matchers with ScalatestRouteT
Source(List(byteString1, byteString2)),
),
) ~> route ~> check {
responseAs[String] // force processing the request
metrics.httpRequestsBytesTotalValue should be(byteString1Size + byteString2Size)
}
}
@ -315,7 +316,9 @@ class AkkaHttpMetricsSpec extends AnyWordSpec with Matchers with ScalatestRouteT
ContentTypes.`application/octet-stream`,
Source(List(byteString1, byteString2)),
),
) ~> route
) ~> route ~> check {
responseAs[String] // force processing the request
}
Get(
"/exception",
HttpEntity.Strict(ContentTypes.`application/octet-stream`, byteString1),