File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -562,16 +562,24 @@ mod tests {
562
562
let ( _, discovery_a) = make_discoverer ( false ) ?;
563
563
let ( node_id_b, discovery_b) = make_discoverer ( false ) ?;
564
564
565
- let node_data = NodeData :: new ( None , BTreeSet :: from ( [ "0.0.0.0:11111" . parse ( ) . unwrap ( ) ] ) ) ;
565
+ let ( node_id_c, discovery_c) = make_discoverer ( true ) ?;
566
+ let node_data_c =
567
+ NodeData :: new ( None , BTreeSet :: from ( [ "0.0.0.0:22222" . parse ( ) . unwrap ( ) ] ) ) ;
568
+ discovery_c. publish ( & node_data_c) ;
566
569
567
- discovery_b. publish ( & node_data) ;
570
+ let node_data_b =
571
+ NodeData :: new ( None , BTreeSet :: from ( [ "0.0.0.0:11111" . parse ( ) . unwrap ( ) ] ) ) ;
572
+ discovery_b. publish ( & node_data_b) ;
568
573
569
- let mut stream = discovery_a. resolve ( node_id_b) . unwrap ( ) ;
574
+ let mut stream_c = discovery_a. resolve ( node_id_c) . unwrap ( ) ;
575
+ let result_c = tokio:: time:: timeout ( Duration :: from_secs ( 2 ) , stream_c. next ( ) ) . await ;
576
+ assert ! ( result_c. is_ok( ) , "Advertising node should be discoverable" ) ;
570
577
571
- let result = tokio:: time:: timeout ( Duration :: from_secs ( 2 ) , stream. next ( ) ) . await ;
578
+ let mut stream_b = discovery_a. resolve ( node_id_b) . unwrap ( ) ;
579
+ let result_b = tokio:: time:: timeout ( Duration :: from_secs ( 2 ) , stream_b. next ( ) ) . await ;
572
580
assert ! (
573
- result . is_err( ) ,
574
- "Expected timeout since node isn't advertising"
581
+ result_b . is_err( ) ,
582
+ "Expected timeout since node b isn't advertising"
575
583
) ;
576
584
577
585
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments