Skip to content

Commit

Permalink
add rstest_reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
conorbros committed Sep 21, 2023
1 parent f9f8d1b commit fcbe28b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions shotover-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ tokio.workspace = true
tracing.workspace = true
clap.workspace = true
rstest = "0.18.0"
rstest_reuse = "0.6.0"
cassandra-cpp = { version = "2.0.0", default-features = false }
test-helpers = { path = "../test-helpers" }
redis.workspace = true
Expand Down
20 changes: 8 additions & 12 deletions shotover-proxy/tests/cassandra_int_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use cdrs_tokio::frame::events::{
use futures::future::join_all;
use futures::Future;
use rstest::rstest;
use rstest_reuse::{self, *};
#[cfg(feature = "cassandra-cpp-driver-tests")]
use test_helpers::connection::cassandra::CassandraDriver::Datastax;
use test_helpers::connection::cassandra::Compression;
Expand Down Expand Up @@ -58,10 +59,14 @@ where
timestamp::test(&connection).await;
}

#[template]
#[rstest]
#[case::cdrs(CdrsTokio)]
#[cfg_attr(feature = "cassandra-cpp-driver-tests", case::datastax(Datastax))]
#[case::scylla(Scylla)]
fn all_cassandra_drivers(#[case] driver: CassandraDriver) {}

#[apply(all_cassandra_drivers)]
#[tokio::test(flavor = "multi_thread")]
async fn passthrough_standard(#[case] driver: CassandraDriver) {
let _compose = docker_compose("tests/test-configs/cassandra/passthrough/docker-compose.yaml");
Expand All @@ -78,10 +83,7 @@ async fn passthrough_standard(#[case] driver: CassandraDriver) {
}

#[cfg(feature = "alpha-transforms")]
#[rstest]
#[case::cdrs(CdrsTokio)]
#[cfg_attr(feature = "cassandra-cpp-driver-tests", case::datastax(Datastax))]
#[case::scylla(Scylla)]
#[apply(all_cassandra_drivers)]
#[tokio::test(flavor = "multi_thread")]
async fn passthrough_encode(#[case] driver: CassandraDriver) {
let _compose = docker_compose("tests/test-configs/cassandra/passthrough/docker-compose.yaml");
Expand Down Expand Up @@ -172,10 +174,7 @@ async fn cluster_single_rack_v3(#[case] driver: CassandraDriver) {
cluster::single_rack_v3::test_topology_task(None).await;
}

#[rstest]
#[case::cdrs(CdrsTokio)]
#[cfg_attr(feature = "cassandra-cpp-driver-tests", case::datastax(Datastax))]
#[case::scylla(Scylla)]
#[apply(all_cassandra_drivers)]
#[tokio::test(flavor = "multi_thread")]
async fn cluster_single_rack_v4(#[case] driver: CassandraDriver) {
let mut compose = docker_compose("tests/test-configs/cassandra/cluster-v4/docker-compose.yaml");
Expand Down Expand Up @@ -329,10 +328,7 @@ async fn source_tls_and_cluster_tls(#[case] driver: CassandraDriver) {
cluster::single_rack_v4::test_topology_task(Some(ca_cert), None).await;
}

#[rstest]
#[case::cdrs(CdrsTokio)]
#[cfg_attr(feature = "cassandra-cpp-driver-tests", case::datastax(Datastax))]
#[case::scylla(Scylla)]
#[apply(all_cassandra_drivers)]
#[tokio::test(flavor = "multi_thread")]
async fn cassandra_redis_cache(#[case] driver: CassandraDriver) {
let _compose = docker_compose("tests/test-configs/cassandra/redis-cache/docker-compose.yaml");
Expand Down
3 changes: 3 additions & 0 deletions shotover-proxy/tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(test)]
use rstest_reuse;

use test_helpers::shotover_process::ShotoverProcessBuilder;
use tokio_bin_process::bin_path;

Expand Down

0 comments on commit fcbe28b

Please sign in to comment.