diff --git a/Cargo.lock b/Cargo.lock index 9044a2ab9..b60be521b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1470,7 +1470,7 @@ version = "0.0.1" dependencies = [ "anyhow", "async-trait", - "redis", + "redis 0.24.0", "serde", "shotover", "test-helpers", @@ -1705,7 +1705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b036571bf708c18acbc0adc4928af31ec3a194003681d9475111469b68d5f63" dependencies = [ "anyhow", - "redis", + "redis 0.23.3", "regex", "serde_yaml", "subprocess", @@ -1953,9 +1953,9 @@ dependencies = [ [[package]] name = "fred" -version = "7.1.0" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9282e65613822eea90c99872c51afa1de61542215cb11f91456a93f50a5a131a" +checksum = "68a3b71b668749c2e44051378ff2e3fb1c09daba1f12e27da2a8e4b7522036a0" dependencies = [ "arc-swap", "async-trait", @@ -2338,7 +2338,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -3654,6 +3654,21 @@ name = "redis" version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba" +dependencies = [ + "combine", + "itoa", + "percent-encoding", + "ryu", + "sha1_smol", + "socket2 0.4.10", + "url", +] + +[[package]] +name = "redis" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c580d9cbbe1d1b479e8d67cf9daf6a62c957e6846048408b80b43ac3f6af84cd" dependencies = [ "async-trait", "bytes", @@ -4518,7 +4533,7 @@ dependencies = [ "prometheus-parse", "rand 0.8.5", "rand_distr", - "redis", + "redis 0.24.0", "redis-protocol", "regex", "reqwest", @@ -4835,7 +4850,7 @@ dependencies = [ "ordered-float", "rcgen", "rdkafka", - "redis", + "redis 0.24.0", "reqwest", "scylla", "serde_yaml", diff --git a/Cargo.toml b/Cargo.toml index f2ab874d8..98a6fe7b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ serde = { version = "1.0.111", features = ["derive"] } serde_yaml = "0.9.17" uuid = { version = "1.0.0", features = ["serde", "v4"] } reqwest = "0.11.6" -redis = { version = "0.23.3", features = ["tokio-comp", "cluster"] } +redis = { version = "0.24.0", features = ["tokio-comp", "cluster"] } cdrs-tokio = "8.0" cassandra-protocol = "3.0" tracing = "0.1.15" diff --git a/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs b/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs index 3fc9812a7..e62ffa732 100644 --- a/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs +++ b/shotover-proxy/tests/redis_int_tests/basic_driver_tests.rs @@ -1,5 +1,7 @@ use crate::redis_int_tests::assert::*; use bytes::BytesMut; +use fred::clients::RedisClient; +use fred::interfaces::KeysInterface; use futures::{Future, StreamExt}; use rand::{thread_rng, Rng}; use rand_distr::Alphanumeric; @@ -1265,15 +1267,11 @@ pub async fn test_dr_auth() { /// A driver variant of this test case is provided so that we can ensure that /// at least one driver handles this as we expect. -pub async fn test_trigger_transform_failure_driver(connection: &mut Connection) { +/// Fred is used here as redis-rs sends an unconfigurable `CLIENT SETINFO` command and ignores the result on connection init. +/// This results in the error message being completely dropped. +pub async fn test_trigger_transform_failure_driver(client: &RedisClient) { assert_eq!( - redis::cmd("SET") - .arg("foo") - .arg(42) - .query_async::<_, ()>(connection) - .await - .unwrap_err() - .to_string(), + client.set::<(), _, _>("foo", 42, None, None, false).await.unwrap_err().details(), "An error was signalled by the server - ResponseError: Internal shotover (or custom transform) bug: Chain failed to send and/or receive messages, the connection will now be closed. Caused by: 0: RedisSinkSingle transform failed 1: Failed to connect to destination \"127.0.0.1:1111\" 2: Connection refused (os error 111)".to_string() ); } diff --git a/shotover-proxy/tests/redis_int_tests/mod.rs b/shotover-proxy/tests/redis_int_tests/mod.rs index fd31fefb9..e08599b19 100644 --- a/shotover-proxy/tests/redis_int_tests/mod.rs +++ b/shotover-proxy/tests/redis_int_tests/mod.rs @@ -1,5 +1,8 @@ use crate::shotover_process; use basic_driver_tests::*; +use fred::clients::RedisClient; +use fred::interfaces::ClientLike; +use fred::types::RedisConfig; use redis::aio::Connection; use redis::Commands; @@ -47,9 +50,13 @@ async fn passthrough_redis_down() { let shotover = shotover_process("tests/test-configs/redis/passthrough/topology.yaml") .start() .await; - let mut connection = redis_connection::new_async("127.0.0.1", 6379).await; + let client = RedisClient::new(RedisConfig::default(), None, None, None); - test_trigger_transform_failure_driver(&mut connection).await; + { + let _shutdown_handle = client.connect(); + client.wait_for_connect().await.unwrap(); + test_trigger_transform_failure_driver(&client).await; + } test_trigger_transform_failure_raw().await; test_invalid_frame().await;