From 39216810985f47af8753c0a0f888502f9307d9d0 Mon Sep 17 00:00:00 2001 From: Conor Date: Fri, 24 Mar 2023 12:02:37 +1100 Subject: [PATCH] Protocol tests (#1095) --- .../tests/cassandra_int_tests/mod.rs | 78 ++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/shotover-proxy/tests/cassandra_int_tests/mod.rs b/shotover-proxy/tests/cassandra_int_tests/mod.rs index c656d369d..23b3b664e 100644 --- a/shotover-proxy/tests/cassandra_int_tests/mod.rs +++ b/shotover-proxy/tests/cassandra_int_tests/mod.rs @@ -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}; @@ -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; +}