Reputation: 54
I have a bidiStream configured as below
.exec(
bidiStream_conf
.start("#{payload}")
.header(metadataObject.Authorization)(s"Bearer ${Key}")
.extract(_.pk.some)(_ saveAs "var")
.sessionCombiner(SessionCombiner.pick("var"))
.endCheck(statusCode is Status.Code.OK)
)
.exitHereIfFailed
.exec(REST_req)
.exec(bidiStream_conf.complete)
.exec(bidiStream_conf.reconciliate(waitFor = NextMessage))
I want to force exit on V.User when stream is failed, so I passed in a false key, when I run this, I got below log
gRPC stream completion:
status=
PERMISSION_DENIED, description: code = E3014, message = Token is invalid!
trailers=
content-type: application/grpc
<<<<<<<<<<<<<<<<<<<<<<<<<
15:45:32.700 [DEBUG] c.g.p.g.g.s.BidiStreamCall - Client issued message but stream bidiStream_conf already completed
================================================================================
2023-11-30 15:45:34 5s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=2 KO=1 )
> bidiStream_Req (OK=0 KO=1 )
> REST_Req (OK=1 KO=0 )
---- Errors --------------------------------------------------------------------
> grpcStatusCode.find.is(OK), but actually found PERMISSION_DENI 1 (100.0%)
ED
Seeing that REST API below is still executed, I think I did exitHereIfFailed
wrong way, how do I properly do that in this case, to force V.User to stop whole scenario completely ?
Upvotes: 0
Views: 109
Reputation: 122
To force an exit of the whole scenario when the gRPC stream fails, you can use Gatling's exitBlockOnFail
method.
Check this code:
.exec(
bidiStream_conf
.start("#{payload}")
.header(metadataObject.Authorization)(s"Bearer ${Key}")
.extract(_.pk.some)(_ saveAs "var")
.sessionCombiner(SessionCombiner.pick("var"))
.endCheck(statusCode is Status.Code.OK)
)
.exitHereIfFailed // Remove this line
.exitBlockOnFail( // Add this block
exec(REST_req),
exec(bidiStream_conf.complete),
exec(bidiStream_conf.reconciliate(waitFor = NextMessage))
)
Upvotes: 0