Looking for some @rustlang help.
How can I spin up a bunch of web servers (e.g. an actix-web app) at the beginning of a test, run the test logic and then shut down the server when the test ends?
I can "mock" the piece of code that is interacting with the 3rd part API by defining a trait and using a mock impl, but then it's indeed not a black box test anymore and I am not exercising all the HTTP handling code that I have there. To do so, I need to spin a mock server.
-
-
If I get your use case correctly. It is not necessarily needed to spin up a webserver. But for real-world scenario tests you can do that. There are two options I can suggest: 1- Use Quickcheck-like framework and write a parameterized mock implementation and make it into [1/n]
-
separate binary. 2- What I have suggested makes tests into separate binary and create N tests will span your server and in the last test do requests. Afterward, servers deliberately exit when they are done. 3- I used Bash for some cases like this: $ server & $ wait $! [2/2]
- 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Writing about stuff to learn how it works, mostly in Rust.
Lead Engineer at