@@ -282,43 +282,27 @@ mod tests {
282
282
283
283
use pallas_network:: {
284
284
facades:: DmqClient ,
285
- miniprotocols:: {
286
- localmsgnotification,
287
- localmsgsubmission:: { DmqMsg , DmqMsgPayload } ,
288
- } ,
285
+ miniprotocols:: { localmsgnotification, localmsgsubmission:: DmqMsg } ,
289
286
} ;
290
287
use tokio:: sync:: { mpsc:: unbounded_channel, watch} ;
291
288
use tokio:: time:: sleep;
292
289
293
290
use mithril_common:: { current_function, test:: TempDir } ;
294
291
295
- use crate :: test_tools:: TestLogger ;
292
+ use crate :: { test :: fake_message :: compute_fake_msg , test_tools:: TestLogger } ;
296
293
297
294
use super :: * ;
298
295
299
296
fn create_temp_dir ( folder_name : & str ) -> PathBuf {
300
297
TempDir :: create_with_short_path ( "dmq_consumer_server" , folder_name)
301
298
}
302
299
303
- fn fake_msg ( ) -> DmqMsg {
304
- DmqMsg {
305
- msg_payload : DmqMsgPayload {
306
- msg_id : vec ! [ 0 , 1 ] ,
307
- msg_body : vec ! [ 0 , 1 , 2 ] ,
308
- kes_period : 10 ,
309
- expires_at : 100 ,
310
- } ,
311
- kes_signature : vec ! [ 0 , 1 , 2 , 3 ] ,
312
- operational_certificate : vec ! [ 0 , 1 , 2 , 3 , 4 ] ,
313
- cold_verification_key : vec ! [ 0 , 1 , 2 , 3 , 4 , 5 ] ,
314
- }
315
- }
316
-
317
300
#[ tokio:: test( flavor = "multi_thread" ) ]
318
301
async fn pallas_dmq_consumer_server_non_blocking_success ( ) {
302
+ let current_function_name = current_function ! ( ) ;
319
303
let ( stop_tx, stop_rx) = watch:: channel ( ( ) ) ;
320
304
let ( signature_dmq_tx, signature_dmq_rx) = unbounded_channel :: < DmqMessage > ( ) ;
321
- let socket_path = create_temp_dir ( current_function ! ( ) ) . join ( "node.socket" ) ;
305
+ let socket_path = create_temp_dir ( current_function_name ) . join ( "node.socket" ) ;
322
306
let cardano_network = CardanoNetwork :: TestNet ( 0 ) ;
323
307
let dmq_consumer_server = Arc :: new ( DmqConsumerServerPallas :: new (
324
308
socket_path. to_path_buf ( ) ,
@@ -327,7 +311,7 @@ mod tests {
327
311
TestLogger :: stdout ( ) ,
328
312
) ) ;
329
313
dmq_consumer_server. register_receiver ( signature_dmq_rx) . await . unwrap ( ) ;
330
- let message = fake_msg ( ) ;
314
+ let message: DmqMsg = compute_fake_msg ( b"test" , current_function_name ) . await . into ( ) ;
331
315
let client = tokio:: spawn ( {
332
316
async move {
333
317
// sleep to avoid refused connection from the server
@@ -375,9 +359,10 @@ mod tests {
375
359
376
360
#[ tokio:: test( flavor = "multi_thread" ) ]
377
361
async fn pallas_dmq_consumer_server_blocking_success ( ) {
362
+ let current_function_name = current_function ! ( ) ;
378
363
let ( stop_tx, stop_rx) = watch:: channel ( ( ) ) ;
379
364
let ( signature_dmq_tx, signature_dmq_rx) = unbounded_channel :: < DmqMessage > ( ) ;
380
- let socket_path = create_temp_dir ( current_function ! ( ) ) . join ( "node.socket" ) ;
365
+ let socket_path = create_temp_dir ( current_function_name ) . join ( "node.socket" ) ;
381
366
let cardano_network = CardanoNetwork :: TestNet ( 0 ) ;
382
367
let dmq_consumer_server = Arc :: new ( DmqConsumerServerPallas :: new (
383
368
socket_path. to_path_buf ( ) ,
@@ -386,7 +371,7 @@ mod tests {
386
371
TestLogger :: stdout ( ) ,
387
372
) ) ;
388
373
dmq_consumer_server. register_receiver ( signature_dmq_rx) . await . unwrap ( ) ;
389
- let message = fake_msg ( ) ;
374
+ let message: DmqMsg = compute_fake_msg ( b"test" , current_function_name ) . await . into ( ) ;
390
375
let client = tokio:: spawn ( {
391
376
async move {
392
377
// sleep to avoid refused connection from the server
0 commit comments