@@ -40,8 +40,8 @@ macro_rules! test_triples {
4040 paste! {
4141
4242
43- #[ test]
44- fn [ <test_redis_preprocessing $z: lower>] ( ) {
43+ #[ tokio :: test]
44+ async fn [ <test_redis_preprocessing $z: lower>] ( ) {
4545 let test_key_prefix = format!( "test_redis_preprocessing_{}" , stringify!( $z) ) ;
4646 let redis_conf = RedisConf :: default ( ) ;
4747 let mut redis_factory = create_redis_factory( test_key_prefix. clone( ) , & redis_conf) ;
@@ -81,8 +81,8 @@ macro_rules! test_triples {
8181 } ;
8282}
8383
84- #[ test]
85- fn test_store_fetch_100_triples ( ) {
84+ #[ tokio :: test]
85+ async fn test_store_fetch_100_triples ( ) {
8686 let test_key_prefix = "test_store_fetch_100_triples" . to_string ( ) ;
8787 let redis_conf = RedisConf :: default ( ) ;
8888 let mut redis_factory = create_redis_factory ( test_key_prefix. clone ( ) , & redis_conf) ;
@@ -118,8 +118,8 @@ fn test_store_fetch_100_triples() {
118118 assert_eq ! ( triples, fetched_triples) ;
119119}
120120
121- #[ test]
122- fn test_store_fetch_100_randoms ( ) {
121+ #[ tokio :: test]
122+ async fn test_store_fetch_100_randoms ( ) {
123123 let test_key_prefix = "test_store_fetch_100_randoms" . to_string ( ) ;
124124 let redis_conf = RedisConf :: default ( ) ;
125125 let mut redis_factory = create_redis_factory ( test_key_prefix. clone ( ) , & redis_conf) ;
@@ -141,8 +141,8 @@ fn test_store_fetch_100_randoms() {
141141 assert_eq ! ( randoms, fetched_shares) ;
142142}
143143
144- #[ test]
145- fn test_store_fetch_100_bits ( ) {
144+ #[ tokio :: test]
145+ async fn test_store_fetch_100_bits ( ) {
146146 let test_key_prefix = "test_store_fetch_100_bits" . to_string ( ) ;
147147 let redis_conf = RedisConf :: default ( ) ;
148148 let mut redis_factory = create_redis_factory ( test_key_prefix. clone ( ) , & redis_conf) ;
@@ -164,8 +164,8 @@ fn test_store_fetch_100_bits() {
164164 assert_eq ! ( bits, fetched_bits) ;
165165}
166166
167- #[ test]
168- fn test_fetch_more_than_stored ( ) {
167+ #[ tokio :: test]
168+ async fn test_fetch_more_than_stored ( ) {
169169 let store_count = 100 ;
170170 let fetch_count = 101 ;
171171
@@ -191,8 +191,8 @@ fn test_fetch_more_than_stored() {
191191 . contains( "Pop length error." ) ) ;
192192}
193193
194- #[ test]
195- fn test_cleanup_on_drop ( ) {
194+ #[ tokio :: test]
195+ async fn test_cleanup_on_drop ( ) {
196196 let test_key_prefix = "test_cleanup_on_drop" . to_string ( ) ;
197197 let redis_conf = RedisConf :: default ( ) ;
198198 let mut redis_factory = create_redis_factory ( test_key_prefix. clone ( ) , & redis_conf) ;
@@ -217,6 +217,10 @@ fn test_cleanup_on_drop() {
217217 // Drop the preprocessing instance
218218 drop ( bit_redis_preprocessing) ;
219219
220+ // Sleep for a while because drop of the Redis preproc is
221+ // sent to a tokio blocking thread so drop might return early
222+ tokio:: time:: sleep ( std:: time:: Duration :: from_secs ( 1 ) ) . await ;
223+
220224 // Check that the shares have been cleaned up
221225 assert_eq ! ( bit_redis_preprocessing_bis. bits_len( ) , 0 ) ;
222226
@@ -360,8 +364,8 @@ fn test_dkg_orchestrator_params8_small_no_sns() {
360364}
361365
362366#[ cfg( feature = "testing" ) ]
363- #[ test]
364- fn test_cast_fail_memory_bit_dec_preprocessing ( ) {
367+ #[ tokio :: test]
368+ async fn test_cast_fail_memory_bit_dec_preprocessing ( ) {
365369 use threshold_fhe:: {
366370 algebra:: galois_rings:: degree_4:: ResiduePolyF4Z64 ,
367371 execution:: online:: preprocessing:: {
0 commit comments