Skip to content

Commit b090022

Browse files
committed
batch it: teardown keyspaces
1 parent 3523097 commit b090022

File tree

1 file changed

+18
-2
lines changed
  • scylla/tests/integration/statements

1 file changed

+18
-2
lines changed

scylla/tests/integration/statements/batch.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async fn batch_statements_and_values_mismatch_detected() {
2121
let session = create_new_session_builder().build().await.unwrap();
2222
let ks = unique_keyspace_name();
2323
session.ddl(format!("CREATE KEYSPACE IF NOT EXISTS {ks} WITH REPLICATION = {{'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}}")).await.unwrap();
24-
session.use_keyspace(ks, false).await.unwrap();
24+
session.use_keyspace(&ks, false).await.unwrap();
2525
session
2626
.ddl("CREATE TABLE IF NOT EXISTS batch_serialization_test (p int PRIMARY KEY, val int)")
2727
.await
@@ -77,6 +77,8 @@ async fn batch_statements_and_values_mismatch_detected() {
7777
))
7878
)
7979
}
80+
81+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
8082
}
8183

8284
#[tokio::test]
@@ -97,7 +99,9 @@ async fn test_large_batch_statements() {
9799
assert_matches!(
98100
batch_insert_result.unwrap_err(),
99101
ExecutionError::BadQuery(BadQuery::TooManyQueriesInBatchStatement(_too_many_queries)) if _too_many_queries == too_many_queries
100-
)
102+
);
103+
104+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
101105
}
102106

103107
async fn create_test_session(session: Session, ks: &String) -> Session {
@@ -216,6 +220,8 @@ async fn test_quietly_prepare_batch() {
216220
.unwrap();
217221
assert_test_batch_table_rows_contain(&session, &[(33, 43), (33, 7), (4, 5)]).await;
218222
}
223+
224+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
219225
}
220226

221227
async fn assert_test_batch_table_rows_contain(sess: &Session, expected_rows: &[(i32, i32)]) {
@@ -275,6 +281,8 @@ async fn test_batch_lwts() {
275281
} else {
276282
test_batch_lwts_for_cassandra(&session, &batch, &batch_deserializer).await;
277283
}
284+
285+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
278286
}
279287

280288
async fn test_batch_lwts_for_scylla(
@@ -455,6 +463,8 @@ async fn test_prepare_batch() {
455463

456464
assert!(session.prepare_batch(&bad_batch).await.is_err());
457465
}
466+
467+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
458468
}
459469

460470
#[tokio::test]
@@ -551,6 +561,8 @@ async fn test_batch() {
551561
.unwrap();
552562

553563
assert_eq!(results, vec![(4, 20, String::from("foobar"))]);
564+
565+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
554566
}
555567

556568
#[tokio::test]
@@ -602,6 +614,8 @@ async fn test_counter_batch() {
602614
)
603615
.await
604616
.unwrap();
617+
618+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
605619
}
606620

607621
// This is a regression test for #1134.
@@ -638,4 +652,6 @@ async fn test_batch_to_multiple_tables() {
638652
.execute_unpaged(&prepared_statement, (1, 2, "ala", 4, 5, "ma"))
639653
.await
640654
.unwrap();
655+
656+
session.ddl(format!("DROP KEYSPACE {ks}")).await.unwrap();
641657
}

0 commit comments

Comments
 (0)