LukeMathWalker / LukeMathWalker/wiremock-rs
Cannot stop the server
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 799
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
Hey, as in issue title. I wanted to test that a service gracefully handles networking issues like server being temporarily unreachable and wanted to do that by dropping the `MockServer`, however this loop actually never finishes:
```rs
use std::time::Duration;
use tokio::{net::TcpStream, time::sleep};
use wiremock::MockServer;
#[tokio::main]
async fn main() {
let server = MockServer::start().await;
let addr = *server.address();
drop(server);
loop {
if TcpStream::connect(addr).await.is_err() {
break;
}
sleep(Duration::from_millis(200)).await;
println!("retrying");
}
}
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with MockServer::start().await and MockServer::address() in the reproduction; verify what dropping MockServer is expected to do and why TcpStream::connect(addr) remains successful. Reproduce the loop, then check that the lifecycle behavior is corrected so dropping the server makes the connection fail and the loop exits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100