This commit is contained in:
Paul 2022-12-30 20:21:38 +01:00
parent 9724911126
commit 0ea292b28c
2 changed files with 8 additions and 8 deletions

View File

@ -489,7 +489,7 @@ mod test {
.await; .await;
} }
for _i in 0..10 { for _ in 0..10 {
ctx.update_blocklist(&mut IpData { ctx.update_blocklist(&mut IpData {
ip: "1.1.1.2".to_string(), ip: "1.1.1.2".to_string(),
hostname: "test2".to_string(), hostname: "test2".to_string(),
@ -541,7 +541,8 @@ mod test {
let pending = ctx.get_blocklist_pending().await; let pending = ctx.get_blocklist_pending().await;
assert_eq!(pending.len(), 4); assert_eq!(pending.len(), 4);
for i in ["1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4"] { let ips = ["1.1.1.1", "1.1.1.2", "1.1.1.3", "1.1.1.4"];
for i in ips {
let ip = ctx let ip = ctx
.blocklist .blocklist
.get(&i.to_string()) .get(&i.to_string())
@ -565,11 +566,10 @@ mod test {
let mut ctx = prepare_test_data().await; let mut ctx = prepare_test_data().await;
let after_gc = ctx.gc_blocklist().await; let after_gc = ctx.gc_blocklist().await;
assert_eq!(after_gc.len(), 2); assert_eq!(after_gc.len(), 2);
for i in &["1.1.1.3", "1.1.1.4"] { let ips = &["1.1.1.3", "1.1.1.4"];
assert_eq!( for ip in ips {
ctx.blocklist.get(&i.to_string()).unwrap().ipdata.ip, let ipstring = ip.to_string();
i.to_string() assert_eq!(ctx.blocklist.get(&ipstring).unwrap().ipdata.ip, ipstring);
);
} }
} }
} }

View File

@ -33,7 +33,7 @@ pub fn _dedup<T: Ord + PartialOrd>(list: &mut Vec<T>) -> usize {
list.len() list.len()
} }
pub fn sleep_ms(ms: u64) { pub fn _sleep_ms(ms: u64) {
std::thread::sleep(Duration::from_millis(ms)); std::thread::sleep(Duration::from_millis(ms));
} }