test: dynamically find open port for test relay

This commit is contained in:
Greg Heartsfield
2022-09-17 14:36:05 -05:00
parent 29b1e8ce58
commit baeb77af99
4 changed files with 35 additions and 6 deletions
+4 -2
View File
@@ -1,11 +1,12 @@
use anyhow::Result;
use std::thread;
use std::time::Duration;
mod common;
#[test]
fn startup() {
let relay = common::start_relay(8080);
fn startup() -> Result<()> {
let relay = common::start_relay()?;
// just make sure we can startup and shut down.
// if we send a shutdown message before the server is listening,
// we will get a SendError. Keep sending until someone is
@@ -24,4 +25,5 @@ fn startup() {
// wait for relay to shutdown
let thread_join = relay.handle.join();
assert!(thread_join.is_ok());
Ok(())
}