From 2bec140009119765d83e3bf7013fada50e7a657c Mon Sep 17 00:00:00 2001 From: travis laduke Date: Thu, 23 Mar 2023 16:06:12 -0700 Subject: [PATCH] cargo fmt --- src/supervise.rs | 5 +++- tests/integration.rs | 56 ++++++++++++++++++++++++---------------- tests/service/mod.rs | 14 +++++++--- tests/service/network.rs | 4 ++- 4 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/supervise.rs b/src/supervise.rs index 37218b7..d6f8f53 100644 --- a/src/supervise.rs +++ b/src/supervise.rs @@ -347,7 +347,10 @@ impl Properties { fn service_name(&self) -> String { format!( "com.zerotier.nsd.{}.plist", - self.launcher.network_id.as_ref().expect("network_id missing") + self.launcher + .network_id + .as_ref() + .expect("network_id missing") ) } diff --git a/tests/integration.rs b/tests/integration.rs index f95e607..eb23fa0 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1,5 +1,4 @@ -use zeronsd::utils::{ init_logger }; - +use zeronsd::utils::init_logger; mod service; @@ -685,8 +684,12 @@ mod all { .await .unwrap(); - let listen_ips = - get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap(), ZEROTIER_LOCAL_URL.into()).await?; + let listen_ips = get_listen_ips( + &authtoken_path(None), + &tn.network.clone().id.unwrap(), + ZEROTIER_LOCAL_URL.into(), + ) + .await?; eprintln!("My listen IP is {}", listen_ips.first().unwrap()); assert_ne!(*listen_ips.first().unwrap(), String::from("")); @@ -701,12 +704,15 @@ mod all { .unwrap(); ips.sort(); - let mut listen_ips: Vec = - get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap(), ZEROTIER_LOCAL_URL.into()) - .await? - .iter() - .map(|x| parse_ip_from_cidr(x.clone()).to_string()) - .collect(); + let mut listen_ips: Vec = get_listen_ips( + &authtoken_path(None), + &tn.network.clone().id.unwrap(), + ZEROTIER_LOCAL_URL.into(), + ) + .await? + .iter() + .map(|x| parse_ip_from_cidr(x.clone()).to_string()) + .collect(); listen_ips.sort(); assert_eq!(listen_ips, ips); @@ -716,12 +722,15 @@ mod all { .await .unwrap(); - let mut listen_ips: Vec = - get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap(), ZEROTIER_LOCAL_URL.into()) - .await? - .iter() - .map(|x| parse_ip_from_cidr(x.clone()).to_string()) - .collect(); + let mut listen_ips: Vec = get_listen_ips( + &authtoken_path(None), + &tn.network.clone().id.unwrap(), + ZEROTIER_LOCAL_URL.into(), + ) + .await? + .iter() + .map(|x| parse_ip_from_cidr(x.clone()).to_string()) + .collect(); listen_ips.sort(); let mut ips = vec![tn.member().clone().rfc4193()?.ip().to_string()]; @@ -736,12 +745,15 @@ mod all { .await .unwrap(); - let mut listen_ips: Vec = - get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap(), ZEROTIER_LOCAL_URL.into()) - .await? - .iter() - .map(|x| parse_ip_from_cidr(x.clone()).to_string()) - .collect(); + let mut listen_ips: Vec = get_listen_ips( + &authtoken_path(None), + &tn.network.clone().id.unwrap(), + ZEROTIER_LOCAL_URL.into(), + ) + .await? + .iter() + .map(|x| parse_ip_from_cidr(x.clone()).to_string()) + .collect(); listen_ips.sort(); let mut ips = vec![tn.member().clone().sixplane()?.ip().to_string()]; diff --git a/tests/service/mod.rs b/tests/service/mod.rs index 9acb82a..9051ea1 100644 --- a/tests/service/mod.rs +++ b/tests/service/mod.rs @@ -24,7 +24,9 @@ use zeronsd::{ authority::{find_members, RecordAuthority, ZTAuthority}, server::Server, traits::{ToHostname, ToPointerSOA}, - utils::{authtoken_path, domain_or_default, get_listen_ips, parse_ip_from_cidr, ZEROTIER_LOCAL_URL}, + utils::{ + authtoken_path, domain_or_default, get_listen_ips, parse_ip_from_cidr, ZEROTIER_LOCAL_URL, + }, }; use self::{ @@ -163,9 +165,13 @@ impl Service { update_interval: Duration, wildcard_everything: bool, ) -> Vec { - let listen_cidrs = get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap(), ZEROTIER_LOCAL_URL.into()) - .await - .unwrap(); + let listen_cidrs = get_listen_ips( + &authtoken_path(None), + &tn.network.clone().id.unwrap(), + ZEROTIER_LOCAL_URL.into(), + ) + .await + .unwrap(); let mut listen_ips = Vec::new(); diff --git a/tests/service/network.rs b/tests/service/network.rs index 56a420c..addb8be 100644 --- a/tests/service/network.rs +++ b/tests/service/network.rs @@ -95,7 +95,9 @@ impl TestNetwork { let id = self.network.id.clone().unwrap(); let mut count = 0; - while let Err(e) = get_listen_ips(&authtoken_path(None), &id, ZEROTIER_LOCAL_URL.into()).await { + while let Err(e) = + get_listen_ips(&authtoken_path(None), &id, ZEROTIER_LOCAL_URL.into()).await + { tokio::time::sleep(Duration::new(1, 0)).await; count += 1; if count >= 5 {