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?
-
Show this thread
-
I have tried using `spawn`, but no clean up takes place until the whole test suites completes. This is troublesome when the number of test grows and some resources start misbehaving (too many open DB connections).
2 replies 0 retweets 0 likesShow this thread -
I considered using something like a supervisor from
@bastion_rs, but `with_exec` and the Actix web server don't like each other (trait bounds issues).1 reply 0 retweets 0 likesShow this thread -
Could I make it happen with a thread and a channel? How do I send the "shutdown" command?
1 reply 0 retweets 0 likesShow this thread -
This would be extremely useful to run servers for HTTP-mocking 3rd party APIs that my application under test is interesting with (for black box testing).
2 replies 0 retweets 1 likeShow this thread -
Replying to @algo_luca
Perhaps an overly simplistic idea, but why not docker-compose? (If you’re not trying to really interrogate the apps themselves)
1 reply 0 retweets 0 likes -
Replying to @ArtRand
That is possible, defining an API to set expectations and mocks on the server, but it would also mean that I need to execute the tests sequentially to make sure they don't interfere with each other.
1 reply 0 retweets 0 likes -
Replying to @algo_luca @ArtRand
If I spin them up programmatically instead, I can have a separate server for each test running on a random port and pass that as the address of the 3rd party API to my API via configuration. So all tests can run in parallel.
1 reply 0 retweets 0 likes -
Replying to @algo_luca
I think you can still do that with compose, it will pick a random port and expose the mapping in the API. However it gets heavyweight very fast. Maybe wrap the process in an actor and shutdown the system (gracefully) on test end?
1 reply 0 retweets 0 likes
That's exactly what I tried to do with Bastion, but I didn't succeed in getting it to compile 
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