@@ -482,6 +482,11 @@ mod tests {
482
482
session
483
483
}
484
484
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
+
485
490
async fn create_caching_session ( ) -> CachingSession {
486
491
let session = CachingSession :: from ( new_for_test ( true ) . await , 2 ) ;
487
492
@@ -533,6 +538,8 @@ mod tests {
533
538
let middle_query_removed = session. cache . get ( middle_query) . is_none ( ) ;
534
539
535
540
assert ! ( first_query_removed || middle_query_removed) ;
541
+
542
+ teardown_keyspace ( session. get_session ( ) ) . await ;
536
543
}
537
544
538
545
/// Checks that the same prepared statement is reused when executing the same query twice
@@ -558,6 +565,8 @@ mod tests {
558
565
559
566
assert_eq ! ( 1 , session. cache. len( ) ) ;
560
567
assert_eq ! ( 1 , result_rows. rows_num( ) ) ;
568
+
569
+ teardown_keyspace ( session. get_session ( ) ) . await ;
561
570
}
562
571
563
572
/// Checks that caching works with execute_iter
@@ -585,6 +594,8 @@ mod tests {
585
594
586
595
assert_eq ! ( 1 , rows) ;
587
596
assert_eq ! ( 1 , session. cache. len( ) ) ;
597
+
598
+ teardown_keyspace ( session. get_session ( ) ) . await ;
588
599
}
589
600
590
601
/// Checks that caching works with execute_single_page
@@ -602,6 +613,8 @@ mod tests {
602
613
603
614
assert_eq ! ( 1 , session. cache. len( ) ) ;
604
615
assert_eq ! ( 1 , result. into_rows_result( ) . unwrap( ) . rows_num( ) ) ;
616
+
617
+ teardown_keyspace ( session. get_session ( ) ) . await ;
605
618
}
606
619
607
620
async fn assert_test_batch_table_rows_contain (
@@ -653,12 +666,15 @@ mod tests {
653
666
async fn test_custom_hasher ( ) {
654
667
setup_tracing ( ) ;
655
668
656
- let _session : CachingSession < std:: collections:: hash_map:: RandomState > =
669
+ let session : CachingSession < std:: collections:: hash_map:: RandomState > =
657
670
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 > =
659
673
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 > =
661
676
CachingSession :: with_hasher ( new_for_test ( true ) . await , 2 , Default :: default ( ) ) ;
677
+ teardown_keyspace ( session. get_session ( ) ) . await ;
662
678
}
663
679
664
680
#[ tokio:: test]
@@ -775,6 +791,8 @@ mod tests {
775
791
assert ! ( session. batch( & bad_batch, ( ( 1 , 2 ) , ( ) , ( 2 , ) ) ) . await . is_err( ) ) ;
776
792
assert ! ( session. prepare_batch( & bad_batch) . await . is_err( ) ) ;
777
793
}
794
+
795
+ teardown_keyspace ( session. get_session ( ) ) . await ;
778
796
}
779
797
780
798
// The CachingSession::execute and friends should have the same StatementConfig
@@ -829,15 +847,15 @@ mod tests {
829
847
830
848
rows. sort_unstable ( ) ;
831
849
assert_eq ! ( rows, vec![ ( 1 , 1000 ) , ( 2 , 2000 ) ] ) ;
850
+
851
+ teardown_keyspace ( session. get_session ( ) ) . await ;
832
852
}
833
853
834
854
// Checks whether the PartitionerName is cached properly.
835
855
#[ tokio:: test]
856
+ #[ cfg_attr( cassandra_tests, ignore) ]
836
857
async fn test_partitioner_name_caching ( ) {
837
858
setup_tracing ( ) ;
838
- if option_env ! ( "CDC" ) == Some ( "disabled" ) {
839
- return ;
840
- }
841
859
842
860
// This test uses CDC which is not yet compatible with Scylla's tablets.
843
861
let session: CachingSession = CachingSession :: from ( new_for_test ( false ) . await , 100 ) ;
@@ -868,6 +886,8 @@ mod tests {
868
886
// one can see which case failed by looking at the full backtrace
869
887
verify_partitioner ( ) . await ;
870
888
verify_partitioner ( ) . await ;
889
+
890
+ teardown_keyspace ( session. get_session ( ) ) . await ;
871
891
}
872
892
873
893
// NOTE: intentionally no `#[test]`: this is a compile-time test
0 commit comments