Skip to content

Commit

Permalink
cleanup of stub structs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Nov 26, 2024
1 parent b0cb517 commit c08c6e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
5 changes: 1 addition & 4 deletions iroh-net/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ pub async fn run_relay_server() -> Result<(RelayMap, RelayUrl, Server)> {
pub async fn run_relay_server_with(
stun: Option<StunConfig>,
) -> Result<(RelayMap, RelayUrl, Server)> {
#[derive(Default, Debug, derive_more::Display)]
struct Stub;

let cert =
rcgen::generate_simple_self_signed(vec!["localhost".to_string(), "127.0.0.1".to_string()])
.expect("valid");
Expand All @@ -53,7 +50,7 @@ pub async fn run_relay_server_with(
relay: Some(RelayConfig {
http_bind_addr: (Ipv4Addr::LOCALHOST, 0).into(),
tls: Some(TlsConfig {
cert: CertConfig::<Stub, Stub>::Manual {
cert: CertConfig::<(), ()>::Manual {
private_key,
certs: vec![rustls_cert.clone()],
},
Expand Down
22 changes: 5 additions & 17 deletions iroh-relay/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,8 @@ mod tests {
};

async fn spawn_local_relay() -> Result<Server> {
#[derive(Debug)]
struct Stub;

Server::spawn(ServerConfig::<Stub, Stub> {
relay: Some(RelayConfig::<Stub, Stub> {
Server::spawn(ServerConfig::<(), ()> {
relay: Some(RelayConfig::<(), ()> {
http_bind_addr: (Ipv4Addr::LOCALHOST, 0).into(),
tls: None,
limits: Default::default(),
Expand All @@ -724,11 +721,8 @@ mod tests {

#[tokio::test]
async fn test_no_services() {
#[derive(Default, Debug)]
struct Stub;

let _guard = iroh_test::logging::setup();
let mut server = Server::spawn(ServerConfig::<Stub, Stub>::default())
let mut server = Server::spawn(ServerConfig::<(), ()>::default())
.await
.unwrap();
let res = tokio::time::timeout(Duration::from_secs(5), server.task_handle())
Expand All @@ -740,11 +734,8 @@ mod tests {

#[tokio::test]
async fn test_conflicting_bind() {
#[derive(Debug)]
struct Stub;

let _guard = iroh_test::logging::setup();
let mut server = Server::spawn(ServerConfig::<Stub, Stub> {
let mut server = Server::spawn(ServerConfig::<(), ()> {
relay: Some(RelayConfig {
http_bind_addr: (Ipv4Addr::LOCALHOST, 1234).into(),
tls: None,
Expand Down Expand Up @@ -1015,11 +1006,8 @@ mod tests {

#[tokio::test]
async fn test_stun() {
#[derive(Debug)]
struct Stub;

let _guard = iroh_test::logging::setup();
let server = Server::spawn(ServerConfig::<Stub, Stub> {
let server = Server::spawn(ServerConfig::<(), ()> {
relay: None,
stun: Some(StunConfig {
bind_addr: (Ipv4Addr::LOCALHOST, 0).into(),
Expand Down

0 comments on commit c08c6e9

Please sign in to comment.