tests(client): fix flaking conn_reset test

This commit is contained in:
Sean McArthur
2018-03-12 14:28:59 -07:00
parent d58aa73246
commit f680fca9ec
2 changed files with 13 additions and 6 deletions

View File

@@ -1,8 +1,10 @@
extern crate pretty_env_logger;
use std::time::Duration;
use futures::Async;
use futures::future::poll_fn;
use tokio::reactor::Core;
use tokio::reactor::{Core, Timeout};
use mock::MockConnector;
use super::*;
@@ -68,6 +70,11 @@ fn conn_reset_after_write() {
Ok(Async::Ready(()))
});
core.run(res1.join(srv1)).expect("res1");
// run a tiny timeout just to spin the core, so that the pool
// can tell the socket is ready again
let timeout = Timeout::new(Duration::from_millis(50), &core.handle()).unwrap();
core.run(timeout).unwrap();
}
let res2 = client.get("http://mock.local/a".parse().unwrap());