How to mock out downstream calls
How can I mock the downstream services for these Nginx tests?
++
What protocol? custom TCP? http? It's possible to extend the test scaffold to support very ad-hoc clients. You can check the existing features as examples.
my intention was to set up nginx virtual servers that would respond with canned mock service responses. Similar set up to the one layed out here: https://underthehood.meltwater.com/blog/2017/12/12/lightweight-tests-for-your-nginx-api-gateway/
i was hoping i could have multiple server blocks defined in one test config.. i haven't quite figured it all out yet, but i found this page helpful: https://openresty.gitbooks.io/programming-openresty/content/testing/testing-erroneous-cases.html
along with a few other open source examples of using the tcp section : https://github.com/dome/lixen_app/blob/2e9d209e1b800caac1f4a4b98352d59f41b903b3/bundle/srcache-nginx-module-0.24/t/timeout.t
Do you have a recommended approach for mocking downstream calls for http?
@ktalebian Have you tried the --- http_config section? You can define your own server blocks there. It's commonly used in, say, ngx_lua's test suite.
@ktalebian The title of this ticket says "downstream calls", which means client side, instead of server side. So I don't think your requirements fit in this github issue.
@agentzh my misunderstanding 😅