summaryrefslogtreecommitdiffstats
path: root/tests/unittests/command_parse/test_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/command_parse/test_server.py')
-rw-r--r--tests/unittests/command_parse/test_server.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/unittests/command_parse/test_server.py b/tests/unittests/command_parse/test_server.py
index 5129e5f..5ecccbf 100644
--- a/tests/unittests/command_parse/test_server.py
+++ b/tests/unittests/command_parse/test_server.py
@@ -31,6 +31,20 @@ def test_client_list(judge_command):
{"command": "client list", "type_const": "TYPE", "conntype": "REPLICA"},
)
+ judge_command(
+ "client list TYPE REPLICA id 1 2 3",
+ {
+ "command": "client list",
+ "type_const": "TYPE",
+ "conntype": "REPLICA",
+ "clientids": "1 2 3",
+ },
+ )
+ judge_command(
+ "client list ID 1 2 3",
+ {"command": "client list", "clientids": "1 2 3"},
+ )
+
def test_configset(judge_command):
judge_command(
@@ -72,6 +86,18 @@ def test_client_kill(judge_command):
{"command": "CLIENT KILL", "ip_port": "127.0.0.1:12345"},
)
judge_command(
+ "CLIENT KILL ADDR 127.0.0.1:12345 ",
+ {"command": "CLIENT KILL", "ip_port": "127.0.0.1:12345", "addr": "ADDR"},
+ )
+ judge_command(
+ "CLIENT KILL LADDR 127.0.0.1:12345 ",
+ {"command": "CLIENT KILL", "ip_port": "127.0.0.1:12345", "laddr": "LADDR"},
+ )
+ judge_command(
+ "CLIENT KILL USER myuser",
+ {"command": "CLIENT KILL", "const_user": "USER", "username": "myuser"},
+ )
+ judge_command(
"CLIENT KILL id 123455 type pubsub skipme no",
{
"command": "CLIENT KILL",
@@ -199,3 +225,48 @@ def test_acl_setuser(judge_command):
def test_acl_getuser(judge_command):
judge_command("acl getuser alan", {"command": "acl getuser", "username": "alan"})
judge_command("acl getuser", None)
+
+
+def test_failover(judge_command):
+ judge_command(
+ "failover to 10.0.0.5 7379 abort timeout 101",
+ {
+ "command": "failover",
+ "to_const": "to",
+ "host": "10.0.0.5",
+ "port": "7379",
+ "abort_const": "abort",
+ "timeout_const": "timeout",
+ "millisecond": "101",
+ },
+ )
+ judge_command(
+ "failover abort timeout 101",
+ {
+ "command": "failover",
+ "abort_const": "abort",
+ "timeout_const": "timeout",
+ "millisecond": "101",
+ },
+ )
+ judge_command(
+ "failover timeout 101",
+ {
+ "command": "failover",
+ "timeout_const": "timeout",
+ "millisecond": "101",
+ },
+ )
+ judge_command(
+ "failover to 10.0.0.5 7379 force abort timeout 101",
+ {
+ "command": "failover",
+ "to_const": "to",
+ "force": "force",
+ "host": "10.0.0.5",
+ "port": "7379",
+ "abort_const": "abort",
+ "timeout_const": "timeout",
+ "millisecond": "101",
+ },
+ )