Skip to content

Commit 82dcc02

Browse files
committed
Fix a bunch of issues with tests
Signed-off-by: Erik Hollensbe <git@hollensbe.org>
1 parent 8d51d33 commit 82dcc02

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

tests/integration.rs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod sixplane {
2727
let mut ips = service.lookup_aaaa(record.clone()).await;
2828
ips.sort();
2929

30-
assert_eq!(ips.sort(), listen_ips.clone().to_ipv6_vec().sort());
30+
assert_eq!(ips, listen_ips.clone().to_ipv6_vec());
3131
}
3232
}
3333

@@ -173,7 +173,7 @@ mod rfc4193 {
173173
let mut ips = service.lookup_aaaa(record.clone()).await;
174174
ips.sort();
175175

176-
assert_eq!(ips.sort(), listen_ips.clone().to_ipv6_vec().sort());
176+
assert_eq!(ips, listen_ips.clone().to_ipv6_vec());
177177
}
178178

179179
let ptr_records: Vec<String> = service
@@ -204,10 +204,10 @@ mod rfc4193 {
204204
for _ in 0..10000 {
205205
// randomly switch order
206206
if rand::random::<bool>() {
207-
assert_eq!(
208-
service.lookup_aaaa(record.clone()).await.sort(),
209-
listen_ips.clone().to_ipv6_vec().sort()
210-
);
207+
let mut ips = service.lookup_aaaa(record.clone()).await;
208+
ips.sort();
209+
210+
assert_eq!(ips, listen_ips.clone().to_ipv6_vec(),);
211211

212212
assert_eq!(
213213
service
@@ -229,10 +229,9 @@ mod rfc4193 {
229229
&record.to_string()
230230
);
231231

232-
assert_eq!(
233-
service.lookup_aaaa(record.clone()).await.sort(),
234-
listen_ips.clone().to_ipv6_vec().sort()
235-
);
232+
let mut ips = service.lookup_aaaa(record.clone()).await;
233+
ips.sort();
234+
assert_eq!(ips, listen_ips.clone().to_ipv6_vec(),);
236235
}
237236
}
238237
}
@@ -454,7 +453,7 @@ mod ipv4 {
454453
let mut ips = service.lookup_a(record.clone()).await;
455454
ips.sort();
456455

457-
assert_eq!(ips.sort(), listen_ips.clone().to_ipv4_vec().sort());
456+
assert_eq!(ips, listen_ips.clone().to_ipv4_vec());
458457
}
459458

460459
let ptr_records: Vec<String> = service
@@ -485,10 +484,9 @@ mod ipv4 {
485484
for _ in 0..10000 {
486485
// randomly switch order
487486
if rand::random::<bool>() {
488-
assert_eq!(
489-
service.lookup_a(record.clone()).await.sort(),
490-
listen_ips.clone().to_ipv4_vec().sort()
491-
);
487+
let mut ips = service.lookup_a(record.clone()).await;
488+
ips.sort();
489+
assert_eq!(ips, listen_ips.clone().to_ipv4_vec(),);
492490

493491
assert_eq!(
494492
service
@@ -510,10 +508,9 @@ mod ipv4 {
510508
&record.to_string()
511509
);
512510

513-
assert_eq!(
514-
service.lookup_a(record.clone()).await.sort(),
515-
listen_ips.clone().to_ipv4_vec().sort()
516-
);
511+
let mut ips = service.lookup_a(record.clone()).await;
512+
ips.sort();
513+
assert_eq!(ips, listen_ips.clone().to_ipv4_vec(),);
517514
}
518515
}
519516
}
@@ -705,11 +702,13 @@ async fn test_get_listen_ip() -> Result<(), anyhow::Error> {
705702
TestNetwork::new_multi_ip("basic-ipv4", &mut TestContext::default().await, ips.clone())
706703
.await
707704
.unwrap();
705+
ips.sort();
708706

709707
let mut listen_ips =
710708
get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap()).await?;
709+
listen_ips.sort();
711710

712-
assert_eq!(listen_ips.sort(), ips.sort());
711+
assert_eq!(listen_ips, ips);
713712
eprintln!("My listen IPs are {}", listen_ips.join(", "));
714713

715714
let tn = TestNetwork::new("rfc4193-only", &mut TestContext::default().await)
@@ -718,10 +717,12 @@ async fn test_get_listen_ip() -> Result<(), anyhow::Error> {
718717

719718
let mut listen_ips =
720719
get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap()).await?;
720+
listen_ips.sort();
721721

722722
let mut ips = vec![tn.member().clone().rfc4193()?.ip().to_string()];
723+
ips.sort();
723724

724-
assert_eq!(listen_ips.sort(), ips.sort());
725+
assert_eq!(listen_ips, ips);
725726
eprintln!("My listen IPs are {}", listen_ips.join(", "));
726727

727728
drop(tn);
@@ -732,10 +733,12 @@ async fn test_get_listen_ip() -> Result<(), anyhow::Error> {
732733

733734
let mut listen_ips =
734735
get_listen_ips(&authtoken_path(None), &tn.network.clone().id.unwrap()).await?;
736+
listen_ips.sort();
735737

736738
let mut ips = vec![tn.member().clone().sixplane()?.ip().to_string()];
739+
ips.sort();
737740

738-
assert_eq!(listen_ips.sort(), ips.sort());
741+
assert_eq!(listen_ips, ips);
739742
eprintln!("My listen IPs are {}", listen_ips.join(", "));
740743

741744
Ok(())

tests/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ fn create_resolvers(sockets: Vec<SocketAddr>) -> Resolvers {
532532
});
533533

534534
let mut opts = ResolverOpts::default();
535-
opts.timeout = Duration::new(10, 0);
535+
opts.attempts = 10;
536536
opts.cache_size = 0;
537537
opts.rotate = true;
538538
opts.use_hosts_file = false;

0 commit comments

Comments
 (0)