Skip to content

Commit 3335c1f

Browse files
committed
ccm: make run_ccm_tests use run_ccm_test_with_configuration
1 parent 866e68e commit 3335c1f

File tree

1 file changed

+6
-19
lines changed
  • scylla/tests/ccm_integration/ccm

1 file changed

+6
-19
lines changed

scylla/tests/ccm_integration/ccm/mod.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,12 @@ where
6161
T: FnOnce(Arc<tokio::sync::Mutex<Cluster>>) -> Fut,
6262
Fut: Future<Output = ()>,
6363
{
64-
let cluster_options = make_cluster_options();
65-
let mut cluster = Cluster::new(cluster_options)
66-
.await
67-
.expect("Failed to create cluster");
68-
cluster.init().await.expect("failed to initialize cluster");
69-
cluster.start(None).await.expect("failed to start cluster");
70-
71-
struct ClusterWrapper(Arc<tokio::sync::Mutex<Cluster>>);
72-
impl Drop for ClusterWrapper {
73-
fn drop(&mut self) {
74-
if std::thread::panicking() && *TEST_KEEP_CLUSTER_ON_FAILURE {
75-
println!("Test failed, keep cluster alive, TEST_KEEP_CLUSTER_ON_FAILURE=true");
76-
self.0.blocking_lock().set_keep_on_drop(true);
77-
}
78-
}
79-
}
80-
let wrapper = ClusterWrapper(Arc::new(tokio::sync::Mutex::new(cluster)));
81-
test_body(Arc::clone(&wrapper.0)).await;
82-
std::mem::drop(wrapper);
64+
run_ccm_test_with_configuration(
65+
make_cluster_options,
66+
|cluster| async move { cluster },
67+
test_body,
68+
)
69+
.await
8370
}
8471

8572
/// Run a CCM test with a custom configuration logic before the cluster starts.

0 commit comments

Comments
 (0)