@@ -482,6 +482,11 @@ mod tests {
482482 session
483483 }
484484
485+ async fn teardown_keyspace ( session : & Session ) {
486+ let ks = session. get_keyspace ( ) . unwrap ( ) ;
487+ session. ddl ( format ! ( "DROP KEYSPACE {ks}" ) ) . await . unwrap ( ) ;
488+ }
489+
485490 async fn create_caching_session ( ) -> CachingSession {
486491 let session = CachingSession :: from ( new_for_test ( true ) . await , 2 ) ;
487492
@@ -533,6 +538,8 @@ mod tests {
533538 let middle_query_removed = session. cache . get ( middle_query) . is_none ( ) ;
534539
535540 assert ! ( first_query_removed || middle_query_removed) ;
541+
542+ teardown_keyspace ( session. get_session ( ) ) . await ;
536543 }
537544
538545 /// Checks that the same prepared statement is reused when executing the same query twice
@@ -558,6 +565,8 @@ mod tests {
558565
559566 assert_eq ! ( 1 , session. cache. len( ) ) ;
560567 assert_eq ! ( 1 , result_rows. rows_num( ) ) ;
568+
569+ teardown_keyspace ( session. get_session ( ) ) . await ;
561570 }
562571
563572 /// Checks that caching works with execute_iter
@@ -585,6 +594,8 @@ mod tests {
585594
586595 assert_eq ! ( 1 , rows) ;
587596 assert_eq ! ( 1 , session. cache. len( ) ) ;
597+
598+ teardown_keyspace ( session. get_session ( ) ) . await ;
588599 }
589600
590601 /// Checks that caching works with execute_single_page
@@ -602,6 +613,8 @@ mod tests {
602613
603614 assert_eq ! ( 1 , session. cache. len( ) ) ;
604615 assert_eq ! ( 1 , result. into_rows_result( ) . unwrap( ) . rows_num( ) ) ;
616+
617+ teardown_keyspace ( session. get_session ( ) ) . await ;
605618 }
606619
607620 async fn assert_test_batch_table_rows_contain (
@@ -653,12 +666,15 @@ mod tests {
653666 async fn test_custom_hasher ( ) {
654667 setup_tracing ( ) ;
655668
656- let _session : CachingSession < std:: collections:: hash_map:: RandomState > =
669+ let session : CachingSession < std:: collections:: hash_map:: RandomState > =
657670 CachingSession :: from ( new_for_test ( true ) . await , 2 ) ;
658- let _session: CachingSession < CustomBuildHasher > =
671+ teardown_keyspace ( session. get_session ( ) ) . await ;
672+ let session: CachingSession < CustomBuildHasher > =
659673 CachingSession :: from ( new_for_test ( true ) . await , 2 ) ;
660- let _session: CachingSession < CustomBuildHasher > =
674+ teardown_keyspace ( session. get_session ( ) ) . await ;
675+ let session: CachingSession < CustomBuildHasher > =
661676 CachingSession :: with_hasher ( new_for_test ( true ) . await , 2 , Default :: default ( ) ) ;
677+ teardown_keyspace ( session. get_session ( ) ) . await ;
662678 }
663679
664680 #[ tokio:: test]
@@ -775,6 +791,8 @@ mod tests {
775791 assert ! ( session. batch( & bad_batch, ( ( 1 , 2 ) , ( ) , ( 2 , ) ) ) . await . is_err( ) ) ;
776792 assert ! ( session. prepare_batch( & bad_batch) . await . is_err( ) ) ;
777793 }
794+
795+ teardown_keyspace ( session. get_session ( ) ) . await ;
778796 }
779797
780798 // The CachingSession::execute and friends should have the same StatementConfig
@@ -829,15 +847,15 @@ mod tests {
829847
830848 rows. sort_unstable ( ) ;
831849 assert_eq ! ( rows, vec![ ( 1 , 1000 ) , ( 2 , 2000 ) ] ) ;
850+
851+ teardown_keyspace ( session. get_session ( ) ) . await ;
832852 }
833853
834854 // Checks whether the PartitionerName is cached properly.
835855 #[ tokio:: test]
856+ #[ cfg_attr( cassandra_tests, ignore) ]
836857 async fn test_partitioner_name_caching ( ) {
837858 setup_tracing ( ) ;
838- if option_env ! ( "CDC" ) == Some ( "disabled" ) {
839- return ;
840- }
841859
842860 // This test uses CDC which is not yet compatible with Scylla's tablets.
843861 let session: CachingSession = CachingSession :: from ( new_for_test ( false ) . await , 100 ) ;
@@ -868,6 +886,8 @@ mod tests {
868886 // one can see which case failed by looking at the full backtrace
869887 verify_partitioner ( ) . await ;
870888 verify_partitioner ( ) . await ;
889+
890+ teardown_keyspace ( session. get_session ( ) ) . await ;
871891 }
872892
873893 // NOTE: intentionally no `#[test]`: this is a compile-time test
0 commit comments