Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mock out downstream calls #95

Open
ktalebian opened this issue Nov 8, 2019 · 6 comments
Open

How to mock out downstream calls #95

ktalebian opened this issue Nov 8, 2019 · 6 comments

Comments

@ktalebian
Copy link

How can I mock the downstream services for these Nginx tests?

@patthiel
Copy link
Contributor

patthiel commented Oct 1, 2020

++

@agentzh
Copy link
Member

agentzh commented Oct 1, 2020

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.

@patthiel
Copy link
Contributor

patthiel commented Oct 1, 2020

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?

@agentzh
Copy link
Member

agentzh commented Oct 1, 2020

@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.

@agentzh
Copy link
Member

agentzh commented Oct 1, 2020

@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.

@patthiel
Copy link
Contributor

patthiel commented Oct 2, 2020

@agentzh my misunderstanding 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants