fix: Intermittent failing CI due to addr in use (#9885)
Allow OS to set port at runtime
This commit is contained in:
parent
09c512abaa
commit
eea5b86cc4
@ -28,8 +28,7 @@ use tests::helpers::{GuardedAuthCodes, Server};
|
|||||||
|
|
||||||
/// Setup a mock signer for tests
|
/// Setup a mock signer for tests
|
||||||
pub fn serve() -> (Server<ws::Server>, usize, GuardedAuthCodes) {
|
pub fn serve() -> (Server<ws::Server>, usize, GuardedAuthCodes) {
|
||||||
let port = 35000 + rand::random::<usize>() % 10000;
|
let address = "127.0.0.1:0".parse().unwrap();
|
||||||
let address = format!("127.0.0.1:{}", port).parse().unwrap();
|
|
||||||
let io = MetaIoHandler::default();
|
let io = MetaIoHandler::default();
|
||||||
let authcodes = GuardedAuthCodes::new();
|
let authcodes = GuardedAuthCodes::new();
|
||||||
let stats = Arc::new(informant::RpcStats::default());
|
let stats = Arc::new(informant::RpcStats::default());
|
||||||
@ -44,6 +43,7 @@ pub fn serve() -> (Server<ws::Server>, usize, GuardedAuthCodes) {
|
|||||||
extractors::WsExtractor::new(Some(&authcodes.path)),
|
extractors::WsExtractor::new(Some(&authcodes.path)),
|
||||||
extractors::WsStats::new(stats),
|
extractors::WsStats::new(stats),
|
||||||
).unwrap());
|
).unwrap());
|
||||||
|
let port = res.addr().port() as usize;
|
||||||
|
|
||||||
(res, port, authcodes)
|
(res, port, authcodes)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user