Closed arcaydian closed 1 year ago
The test scaffolding comes with a simple mock backend that echo's the request received. That can be used for server-B
. For server-A
you can create a separate mock. Use pongo docs
to generate the docs, and then check for the shell helper start_kong
, it has an example how to create a mock http server.
I use MockServer for cases like this. You can mock many different responses. I have a simple example here
TIL MockServer! that is really neat @brentos 👍
@brentos @Tieske I greatly appreciate your help. I will reopen this issue later if required.
I have a lua plugin that, on receiving any request (
request-A
), sends a new request to a server (server-A
) and gets a response (response-A
) from the server. After receivingresponse-A
from theserver-A
, the plugin sets theresponse-A
in the header of therequest-A
and forwards therequest-A
to the target server (server-B
), which returnsresponse-B
.How can I mock two separate servers (
server-A
andserver-B
) and assert the returned hardcoded JSON responses (response-A
andresponse-B
) received throughout the execution cycle of the plugin in a single test case?Additional details: Kong version - [3.x-ubuntu-focal] (https://download.konghq.com/gateway-3.x-ubuntu-focal/) Pongo version - 2.6.0 Kong port - 80 Server-A port - 9090 Server-B port - 8080