This commit is contained in:
2025-08-16 09:50:56 +02:00
parent 0000d82799
commit dbd0635cd9
11 changed files with 139 additions and 142 deletions

View File

@@ -120,9 +120,7 @@ async fn all_tests() {
test_transaction_operations(&mut conn).await;
test_discard_transaction(&mut conn).await;
test_type_command(&mut conn).await;
test_config_commands(&mut conn).await;
test_info_command(&mut conn).await;
test_error_handling(&mut conn).await;
}
async fn test_basic_ping(conn: &mut Connection) {
@@ -308,23 +306,6 @@ async fn test_type_command(conn: &mut Connection) {
cleanup_keys(conn).await;
}
async fn test_config_commands(conn: &mut Connection) {
cleanup_keys(conn).await;
let result: Vec<String> = redis::cmd("CONFIG")
.arg("GET")
.arg("databases")
.query(conn)
.unwrap();
assert_eq!(result, vec!["databases", "16"]);
let result: Vec<String> = redis::cmd("CONFIG")
.arg("GET")
.arg("dir")
.query(conn)
.unwrap();
assert_eq!(result[0], "dir");
assert!(result[1].contains("/tmp/herodb_test_"));
cleanup_keys(conn).await;
}
async fn test_info_command(conn: &mut Connection) {
cleanup_keys(conn).await;
@@ -334,17 +315,3 @@ async fn test_info_command(conn: &mut Connection) {
assert!(result.contains("role:master"));
cleanup_keys(conn).await;
}
async fn test_error_handling(conn: &mut Connection) {
cleanup_keys(conn).await;
let _: () = conn.set("string", "value").unwrap();
let result: RedisResult<String> = conn.hget("string", "field");
assert!(result.is_err());
let result: RedisResult<String> = redis::cmd("UNKNOWN").query(conn);
assert!(result.is_err());
let result: RedisResult<Vec<String>> = redis::cmd("EXEC").query(conn);
assert!(result.is_err());
let result: RedisResult<()> = redis::cmd("DISCARD").query(conn);
assert!(result.is_err());
cleanup_keys(conn).await;
}