Having multiple servers talk to each other in rocket test environment

Viewed 67

I have a situation where I want two servers to talk to each other in a test. As in Server A is triggered and then sends a message to Server B.

I can send requests to both Server A and B individually, but when I try to get Server A to talk to B at 0.0.0.0:[port] I get ConnectionRefused, message: "Connection refused"

edit I wrote out an example

https://github.com/JesseAbram/rocket_testing_issue

1 Answers

The Rocket Client used for testing uses a function called launch_local() which starts the server without binding to any listening addresses. So instead of using that, I spun up servers as normal in separate threads so they were not blocking, and then used reqwest to talk to them.

Related