...
This commit is contained in:
@@ -25,7 +25,7 @@ async fn debug_hset_simple() {
|
||||
dir: test_dir.to_string(),
|
||||
port,
|
||||
debug: false,
|
||||
max_databases: Some(16),
|
||||
encrypt: false,
|
||||
encryption_key: None,
|
||||
};
|
||||
|
||||
|
@@ -16,7 +16,7 @@ async fn debug_hset_return_value() {
|
||||
dir: test_dir.to_string(),
|
||||
port: 16390,
|
||||
debug: false,
|
||||
max_databases: Some(16),
|
||||
encrypt: false,
|
||||
encryption_key: None,
|
||||
};
|
||||
|
||||
|
@@ -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;
|
||||
}
|
@@ -20,7 +20,7 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
|
||||
dir: test_dir,
|
||||
port,
|
||||
debug: true,
|
||||
max_databases: Some(16),
|
||||
encrypt: false,
|
||||
encryption_key: None,
|
||||
};
|
||||
|
||||
@@ -581,22 +581,19 @@ async fn test_list_operations() {
|
||||
|
||||
// Test LRANGE
|
||||
let response = send_command(&mut stream, "*4\r\n$6\r\nLRANGE\r\n$4\r\nlist\r\n$1\r\n0\r\n$2\r\n-1\r\n").await;
|
||||
assert!(response.contains("b"));
|
||||
assert!(response.contains("a"));
|
||||
assert!(response.contains("c"));
|
||||
assert!(response.contains("d"));
|
||||
assert_eq!(response, "*4\r\n$1\r\nb\r\n$1\r\na\r\n$1\r\nc\r\n$1\r\nd\r\n");
|
||||
|
||||
// Test LINDEX
|
||||
let response = send_command(&mut stream, "*3\r\n$6\r\nLINDEX\r\n$4\r\nlist\r\n$1\r\n0\r\n").await;
|
||||
assert!(response.contains("b"));
|
||||
assert_eq!(response, "$1\r\nb\r\n");
|
||||
|
||||
// Test LPOP
|
||||
let response = send_command(&mut stream, "*2\r\n$4\r\nLPOP\r\n$4\r\nlist\r\n").await;
|
||||
assert!(response.contains("b"));
|
||||
assert_eq!(response, "$1\r\nb\r\n");
|
||||
|
||||
// Test RPOP
|
||||
let response = send_command(&mut stream, "*2\r\n$4\r\nRPOP\r\n$4\r\nlist\r\n").await;
|
||||
assert!(response.contains("d"));
|
||||
assert_eq!(response, "$1\r\nd\r\n");
|
||||
|
||||
// Test LREM
|
||||
send_command(&mut stream, "*3\r\n$5\r\nLPUSH\r\n$4\r\nlist\r\n$1\r\na\r\n").await; // list is now a, c, a
|
||||
|
@@ -22,7 +22,7 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
|
||||
dir: test_dir,
|
||||
port,
|
||||
debug: true,
|
||||
max_databases: Some(16),
|
||||
encrypt: false,
|
||||
encryption_key: None,
|
||||
};
|
||||
|
||||
|
@@ -20,7 +20,8 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
|
||||
dir: test_dir,
|
||||
port,
|
||||
debug: false,
|
||||
databases: 16,
|
||||
encrypt: false,
|
||||
encryption_key: None,
|
||||
};
|
||||
|
||||
let server = Server::new(option).await;
|
||||
|
Reference in New Issue
Block a user