From 0edddc24359c50da3f8396075250115e7bd44b9f Mon Sep 17 00:00:00 2001 From: ArtemIsmagilov <118372045+ArtemIsmagilov@users.noreply.github.com> Date: Mon, 6 Jan 2025 09:49:51 +0400 Subject: [PATCH] - impl SLOWLOG HELP (#96) - remove serial attrs for help tests --- src/commands/server_commands.rs | 33 ++++++++++++++++++++++++++++++++ src/tests/connection_commands.rs | 1 - src/tests/generic_commands.rs | 1 - src/tests/server_commands.rs | 17 ++++++++++------ 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/commands/server_commands.rs b/src/commands/server_commands.rs index c36298c..f7882c3 100644 --- a/src/commands/server_commands.rs +++ b/src/commands/server_commands.rs @@ -1101,6 +1101,39 @@ pub trait ServerCommands<'a> { prepare_command(self, cmd("SLOWLOG").arg("GET").arg(options)) } + /// The command returns a helpful text describing the different SLOWLOG subcommands. + /// + /// # Return + /// An array of strings. + /// + /// # Example + /// ``` + /// # use rustis::{ + /// # client::Client, + /// # commands::ServerCommands, + /// # Result, + /// # }; + /// # + /// # #[cfg_attr(feature = "tokio-runtime", tokio::main)] + /// # #[cfg_attr(feature = "async-std-runtime", async_std::main)] + /// # async fn main() -> Result<()> { + /// # let client = Client::connect("127.0.0.1:6379").await?; + /// let result: Vec = client.slowlog_help().await?; + /// assert!(result.iter().any(|e| e == "HELP")); + /// # Ok(()) + /// # } + /// ``` + /// + /// # See Also + /// [](https://redis.io/commands/slowlog-help/) + #[must_use] + fn slowlog_help(self) -> PreparedCommand<'a, Self, Vec> + where + Self: Sized, + { + prepare_command(self, cmd("SLOWLOG").arg("HELP")) + } + /// This command returns the current number of entries in the slow log. /// /// # See Also diff --git a/src/tests/connection_commands.rs b/src/tests/connection_commands.rs index dbab020..5ce8ae5 100644 --- a/src/tests/connection_commands.rs +++ b/src/tests/connection_commands.rs @@ -70,7 +70,6 @@ async fn client_getredir() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::main)] #[cfg_attr(feature = "async-std-runtime", async_std::main)] -#[serial] async fn client_help() -> Result<()> { let client = get_test_client().await?; let result: Vec = client.client_help().await?; diff --git a/src/tests/generic_commands.rs b/src/tests/generic_commands.rs index 8cd4eb3..19e2cb0 100644 --- a/src/tests/generic_commands.rs +++ b/src/tests/generic_commands.rs @@ -314,7 +314,6 @@ async fn object_freq() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] -#[serial] async fn object_help() -> Result<()> { let client = get_test_client().await?; let result: Vec = client.object_help().await?; diff --git a/src/tests/server_commands.rs b/src/tests/server_commands.rs index 005eed3..a35c450 100644 --- a/src/tests/server_commands.rs +++ b/src/tests/server_commands.rs @@ -122,7 +122,6 @@ async fn acl_getuser() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] -#[serial] async fn acl_help() -> Result<()> { let client = get_test_client().await?; @@ -322,7 +321,6 @@ async fn command() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] -#[serial] async fn command_help() -> Result<()> { let client = get_test_client().await?; @@ -481,7 +479,6 @@ async fn config_get() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::main)] #[cfg_attr(feature = "async-std-runtime", async_std::main)] -#[serial] async fn config_help() -> Result<()> { let client = get_test_client().await?; let result: Vec = client.config_help().await?; @@ -722,7 +719,6 @@ async fn latency_graph() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] -#[serial] async fn latency_help() -> Result<()> { let client = get_test_client().await?; @@ -864,7 +860,6 @@ async fn memory_doctor() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] -#[serial] async fn memory_help() -> Result<()> { let client = get_test_client().await?; @@ -941,7 +936,6 @@ async fn memory_usage() -> Result<()> { #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] -#[serial] async fn module_help() -> Result<()> { let client = get_test_client().await?; @@ -1199,6 +1193,17 @@ async fn slowlog_get() -> Result<()> { Ok(()) } +#[cfg_attr(feature = "tokio-runtime", tokio::test)] +#[cfg_attr(feature = "async-std-runtime", async_std::test)] +async fn slowlog_help() -> Result<()> { + let client = get_test_client().await?; + + let result = client.slowlog_help().await?; + assert!(result.iter().any(|e| e == "HELP")); + + Ok(()) +} + #[cfg_attr(feature = "tokio-runtime", tokio::test)] #[cfg_attr(feature = "async-std-runtime", async_std::test)] #[serial]