aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoromagdy <omar.professional8777@gmail.com>2025-07-23 07:53:14 +0300
committeromagdy <omar.professional8777@gmail.com>2025-07-23 07:53:14 +0300
commitd7d2377772e31fafb56f8107a6a22df4a26846d9 (patch)
treea718c6d258a758b2711dd8e6ffc45ae0f5b31905 /tests
parent1f2f3a241c59f467df5bf16fbde872f5083a174f (diff)
downloadredis-rust-d7d2377772e31fafb56f8107a6a22df4a26846d9.tar.xz
redis-rust-d7d2377772e31fafb56f8107a6a22df4a26846d9.zip
refactor+feat: Did overhaul refactoring for how I model each server data and also add a feat to propagate write commands to replicas
Diffstat (limited to 'tests')
-rw-r--r--tests/test_commands.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_commands.rs b/tests/test_commands.rs
index e71db38..86b9cbc 100644
--- a/tests/test_commands.rs
+++ b/tests/test_commands.rs
@@ -141,7 +141,8 @@ mod command_parser_tests {
/// Tests for the command execution logic in `RedisCommands::execute`.
mod command_execution_tests {
- use codecrafters_redis::{resp_commands::RedisCommands, Config};
+ use codecrafters_redis::resp_commands::RedisCommands;
+ use codecrafters_redis::server::RedisServer;
use std::time::Duration;
use super::*;
@@ -149,8 +150,10 @@ mod command_execution_tests {
/// Helper to parse and execute a command against a cache.
fn run_command(cache: &SharedCache, args: &[&str]) -> Vec<u8> {
let command = RedisCommands::from(build_command_from_str_slice(args));
- let config = Arc::new(Some(Config::default()));
- command.execute(Arc::clone(cache), config)
+ let mut server = RedisServer::master();
+ server.set_cache(cache);
+
+ command.execute(Arc::new(Mutex::new(server)))
}
#[test]