Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol tests #1095

Merged
merged 5 commits into from Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
78 changes: 77 additions & 1 deletion shotover-proxy/tests/cassandra_int_tests/mod.rs
Expand Up @@ -8,11 +8,11 @@ use rstest::rstest;
use serial_test::serial;
#[cfg(feature = "cassandra-cpp-driver-tests")]
use test_helpers::connection::cassandra::CassandraDriver::Datastax;
use test_helpers::connection::cassandra::Compression;
use test_helpers::connection::cassandra::{
assert_query_result, run_query, CassandraConnection, CassandraConnectionBuilder,
CassandraDriver, CassandraDriver::CdrsTokio, CassandraDriver::Scylla, ResultValue,
};
use test_helpers::connection::cassandra::{Compression, ProtocolVersion};
use test_helpers::connection::redis_connection;
use test_helpers::docker_compose::DockerCompose;
use test_helpers::shotover_process::{Count, EventMatcher, Level, ShotoverProcessBuilder};
Expand Down Expand Up @@ -811,3 +811,79 @@ async fn events_keyspace(#[case] driver: CassandraDriver) {

shotover.shutdown_and_then_consume_events(&[]).await;
}

// TODO find and fix the cause of this failing test https://github.com/shotover/shotover-proxy/issues/1096
#[rstest]
#[case::cdrs(CdrsTokio)]
#[tokio::test(flavor = "multi_thread")]
#[serial]
async fn test_protocol_v3(#[case] driver: CassandraDriver) {
let _docker_compose =
DockerCompose::new("example-configs/cassandra-passthrough/docker-compose.yaml");

let shotover = ShotoverProcessBuilder::new_with_topology(
"example-configs/cassandra-passthrough/topology-encode.yaml",
)
.start()
.await;

let _connection = || {
CassandraConnectionBuilder::new("127.0.0.1", 9042, driver)
.with_protocol_version(ProtocolVersion::V3)
.build()
};

// standard_test_suite(&connection, driver).await;

shotover.shutdown_and_then_consume_events(&[]).await;
}

#[rstest]
#[case::cdrs(CdrsTokio)]
#[tokio::test(flavor = "multi_thread")]
#[serial]
async fn test_protocol_v4(#[case] driver: CassandraDriver) {
let _docker_compose =
DockerCompose::new("example-configs/cassandra-passthrough/docker-compose.yaml");

let shotover = ShotoverProcessBuilder::new_with_topology(
"example-configs/cassandra-passthrough/topology-encode.yaml",
)
.start()
.await;

let connection = || {
CassandraConnectionBuilder::new("127.0.0.1", 9042, driver)
.with_protocol_version(ProtocolVersion::V4)
.build()
};

standard_test_suite(&connection, driver).await;

shotover.shutdown_and_then_consume_events(&[]).await;
}

#[rstest]
#[case::cdrs(CdrsTokio)]
#[tokio::test(flavor = "multi_thread")]
#[serial]
async fn test_protocol_v5(#[case] _driver: CassandraDriver) {
let _docker_compose =
DockerCompose::new("example-configs/cassandra-passthrough/docker-compose.yaml");

let shotover = ShotoverProcessBuilder::new_with_topology(
"example-configs/cassandra-passthrough/topology-encode.yaml",
)
.start()
.await;

// let connection = || {
// CassandraConnectionBuilder::new("127.0.0.1", 9042, driver)
// .with_protocol_version(ProtocolVersion::V5)
// .build()
// };

// standard_test_suite(&connection, driver).await;

shotover.shutdown_and_then_consume_events(&[]).await;
}