@@ -368,7 +368,6 @@ enum CostModelNotification {
368368mod tests {
369369 use std:: time:: Duration ;
370370
371- use sqlx:: PgPool ;
372371 use tap_core:: receipt:: { checks:: Check , Context } ;
373372 use test_assets:: { create_signed_receipt, flush_messages, SignedReceiptRequest } ;
374373 use tokio:: time:: sleep;
@@ -379,14 +378,18 @@ mod tests {
379378 tap:: { CheckingReceipt , TapReceipt } ,
380379 } ;
381380
382- #[ sqlx:: test( migrations = "../../migrations" ) ]
383- async fn initialize_check ( pgpool : PgPool ) {
381+ #[ tokio:: test]
382+ async fn initialize_check ( ) {
383+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
384+ let pgpool = test_db. pool ;
384385 let check = MinimumValue :: new ( pgpool, Duration :: from_secs ( 0 ) ) . await ;
385386 assert_eq ! ( check. cost_model_map. read( ) . unwrap( ) . len( ) , 0 ) ;
386387 }
387388
388- #[ sqlx:: test( migrations = "../../migrations" ) ]
389- async fn should_initialize_check_with_models ( pgpool : PgPool ) {
389+ #[ tokio:: test]
390+ async fn should_initialize_check_with_models ( ) {
391+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
392+ let pgpool = test_db. pool ;
390393 // insert 2 cost models for different deployment_id
391394 let test_models = test:: test_data ( ) ;
392395
@@ -399,8 +402,10 @@ mod tests {
399402 assert ! ( check. global_model. read( ) . unwrap( ) . is_none( ) ) ;
400403 }
401404
402- #[ sqlx:: test( migrations = "../../migrations" ) ]
403- async fn should_watch_model_insert ( pgpool : PgPool ) {
405+ #[ tokio:: test]
406+ async fn should_watch_model_insert ( ) {
407+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
408+ let pgpool = test_db. pool ;
404409 let mut check = MinimumValue :: new ( pgpool. clone ( ) , Duration :: from_secs ( 0 ) ) . await ;
405410 assert_eq ! ( check. cost_model_map. read( ) . unwrap( ) . len( ) , 0 ) ;
406411
@@ -416,8 +421,10 @@ mod tests {
416421 ) ;
417422 }
418423
419- #[ sqlx:: test( migrations = "../../migrations" ) ]
420- async fn should_watch_model_remove ( pgpool : PgPool ) {
424+ #[ tokio:: test]
425+ async fn should_watch_model_remove ( ) {
426+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
427+ let pgpool = test_db. pool ;
421428 // insert 2 cost models for different deployment_id
422429 let test_models = test:: test_data ( ) ;
423430 add_cost_models ( & pgpool, to_db_models ( test_models. clone ( ) ) ) . await ;
@@ -436,17 +443,21 @@ mod tests {
436443 assert_eq ! ( check. cost_model_map. read( ) . unwrap( ) . len( ) , 0 ) ;
437444 }
438445
439- #[ sqlx:: test( migrations = "../../migrations" ) ]
440- async fn should_start_global_model ( pgpool : PgPool ) {
446+ #[ tokio:: test]
447+ async fn should_start_global_model ( ) {
448+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
449+ let pgpool = test_db. pool ;
441450 let global_model = global_cost_model ( ) ;
442451 add_cost_models ( & pgpool, vec ! [ global_model. clone( ) ] ) . await ;
443452
444453 let check = MinimumValue :: new ( pgpool. clone ( ) , Duration :: from_secs ( 0 ) ) . await ;
445454 assert ! ( check. global_model. read( ) . unwrap( ) . is_some( ) ) ;
446455 }
447456
448- #[ sqlx:: test( migrations = "../../migrations" ) ]
449- async fn should_watch_global_model ( pgpool : PgPool ) {
457+ #[ tokio:: test]
458+ async fn should_watch_global_model ( ) {
459+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
460+ let pgpool = test_db. pool ;
450461 let mut check = MinimumValue :: new ( pgpool. clone ( ) , Duration :: from_secs ( 0 ) ) . await ;
451462
452463 let global_model = global_cost_model ( ) ;
@@ -457,8 +468,10 @@ mod tests {
457468 assert ! ( check. global_model. read( ) . unwrap( ) . is_some( ) ) ;
458469 }
459470
460- #[ sqlx:: test( migrations = "../../migrations" ) ]
461- async fn should_remove_global_model ( pgpool : PgPool ) {
471+ #[ tokio:: test]
472+ async fn should_remove_global_model ( ) {
473+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
474+ let pgpool = test_db. pool ;
462475 let global_model = global_cost_model ( ) ;
463476 add_cost_models ( & pgpool, vec ! [ global_model. clone( ) ] ) . await ;
464477
@@ -475,8 +488,10 @@ mod tests {
475488 assert_eq ! ( check. cost_model_map. read( ) . unwrap( ) . len( ) , 0 ) ;
476489 }
477490
478- #[ sqlx:: test( migrations = "../../migrations" ) ]
479- async fn should_check_minimal_value ( pgpool : PgPool ) {
491+ #[ tokio:: test]
492+ async fn should_check_minimal_value ( ) {
493+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
494+ let pgpool = test_db. pool ;
480495 // insert cost models for different deployment_id
481496 let test_models = test:: test_data ( ) ;
482497
@@ -565,8 +580,10 @@ mod tests {
565580 . expect ( "should accept more than minimal" ) ;
566581 }
567582
568- #[ sqlx:: test( migrations = "../../migrations" ) ]
569- async fn should_check_using_global ( pgpool : PgPool ) {
583+ #[ tokio:: test]
584+ async fn should_check_using_global ( ) {
585+ let test_db = test_assets:: setup_shared_test_db ( ) . await ;
586+ let pgpool = test_db. pool ;
570587 // insert cost models for different deployment_id
571588 let test_models = test:: test_data ( ) ;
572589 let global_model = global_cost_model ( ) ;
0 commit comments