File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ mod tests {
199199 use std:: time:: Duration ;
200200
201201 #[ test]
202- fn zmq_works ( ) {
202+ fn zmq_same_thread ( ) {
203203 _ = env_logger:: try_init ( ) ;
204204 let period = Duration :: from_millis ( 50 ) ;
205205 for run_mode in [
@@ -212,15 +212,27 @@ mod tests {
212212 let send = ticker ( period) . count ( ) . logged ( "pub" , Info ) . zmq_send ( port) ;
213213 let rec = zmq_rec :: < u64 > ( address. as_str ( ) )
214214 . logged ( "sub" , Info )
215- . as_node ( ) ;
215+ . collect ( )
216+ . finally ( |res, _| {
217+ let res: Vec < u64 > = res. into_iter ( ) . flat_map ( |item| item. value ) . collect ( ) ;
218+ println ! ( "{res:?}" ) ;
219+ assert ! (
220+ res. len( ) >= 5 ,
221+ "expected at least 5 items, got {}" ,
222+ res. len( )
223+ ) ;
224+ for window in res. windows ( 2 ) {
225+ assert_eq ! ( window[ 1 ] , window[ 0 ] + 1 , "expected consecutive integers" ) ;
226+ }
227+ } ) ;
216228 let nodes = vec ! [ send, rec] ;
217229 let run_for = RunFor :: Duration ( period * 10 ) ;
218230 Graph :: new ( nodes, run_mode, run_for) . print ( ) . run ( ) . unwrap ( ) ;
219231 }
220232 }
221233
222234 #[ test]
223- fn zmq_really_works ( ) {
235+ fn zmq_seperate_threads ( ) {
224236 _ = env_logger:: try_init ( ) ;
225237 let period = Duration :: from_millis ( 10 ) ;
226238 for run_mode in [
You can’t perform that action at this time.
0 commit comments