File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -567,12 +567,24 @@ impl KvStore for PostgresBackendImpl {
567567mod tests {
568568 use crate :: postgres_store:: PostgresBackendImpl ;
569569 use api:: define_kv_store_tests;
570+ use tokio:: sync:: OnceCell ;
570571
571- define_kv_store_tests ! (
572- PostgresKvStoreTest ,
573- PostgresBackendImpl ,
572+ static START : OnceCell < ( ) > = OnceCell :: const_new ( ) ;
573+
574+ define_kv_store_tests ! ( PostgresKvStoreTest , PostgresBackendImpl , {
575+ START
576+ . get_or_init( || async {
577+ // Initialize the database once, and have other threads wait
578+ PostgresBackendImpl :: new(
579+ "postgresql://postgres:postgres@localhost:5432" ,
580+ "postgres" ,
581+ )
582+ . await
583+ . unwrap( ) ;
584+ } )
585+ . await ;
574586 PostgresBackendImpl :: new( "postgresql://postgres:postgres@localhost:5432" , "postgres" )
575587 . await
576588 . unwrap( )
577- ) ;
589+ } ) ;
578590}
You can’t perform that action at this time.
0 commit comments