feat: add support for server and update cts.py
- add support for server - format output in cts.py - fix some bugs in cts.py Signed-off-by: Pengda Yang <daz-3ux@proton.me>
This commit is contained in:
parent
2bdd922e3f
commit
7375e11178
283
cts.json
283
cts.json
|
@ -4965,5 +4965,288 @@
|
|||
2
|
||||
],
|
||||
"since": "7.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "acl deluser command",
|
||||
"command": [
|
||||
"acl deluser nonexisting"
|
||||
],
|
||||
"result": [
|
||||
0
|
||||
],
|
||||
"since": "6.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "acl dryrun command",
|
||||
"command": [
|
||||
"acl dryrun default set foo bar"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "7.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "acl log command",
|
||||
"command": [
|
||||
"acl log"
|
||||
],
|
||||
"result": [
|
||||
[]
|
||||
],
|
||||
"since": "6.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "acl setuser command",
|
||||
"command": [
|
||||
"acl setuser test reset",
|
||||
"acl deluser test"
|
||||
],
|
||||
"result": [
|
||||
"OK",
|
||||
1
|
||||
],
|
||||
"since": "6.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "acl users command",
|
||||
"command": [
|
||||
"acl users"
|
||||
],
|
||||
"result": [
|
||||
[
|
||||
"default"
|
||||
]
|
||||
],
|
||||
"since": "6.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "acl whoami command",
|
||||
"command": [
|
||||
"acl whoami"
|
||||
],
|
||||
"result": [
|
||||
"default"
|
||||
],
|
||||
"since": "6.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "bgsave with SCHEDULE",
|
||||
"command": [
|
||||
],
|
||||
"result": [
|
||||
],
|
||||
"since": "3.2.2"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "bgsave command",
|
||||
"command": [
|
||||
"bgsave"
|
||||
],
|
||||
"result": [
|
||||
"True"
|
||||
],
|
||||
"since": "1.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "bgrewriteaof command",
|
||||
"command": [
|
||||
"bgrewriteaof",
|
||||
"config set appendfsync no"
|
||||
],
|
||||
"result": [
|
||||
"True",
|
||||
"OK"
|
||||
],
|
||||
"since": "1.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "config get command",
|
||||
"command": [
|
||||
"config get 1"
|
||||
],
|
||||
"result": [
|
||||
[]
|
||||
],
|
||||
"since": "2.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "config get with multiple arguments",
|
||||
"command": [
|
||||
"config get 1 2"
|
||||
],
|
||||
"result": [
|
||||
[]
|
||||
],
|
||||
"since": "7.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "config resetstat command",
|
||||
"command": [
|
||||
"config resetstat"
|
||||
],
|
||||
"result": [
|
||||
"True"
|
||||
],
|
||||
"since": "2.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "config set command",
|
||||
"command": [
|
||||
"config set appendfsync no"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "2.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "dbsize command",
|
||||
"command": [
|
||||
"dbsize"
|
||||
],
|
||||
"result": [
|
||||
0
|
||||
],
|
||||
"since": "1.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "flushall command",
|
||||
"command": [
|
||||
"flushall"
|
||||
],
|
||||
"result": [
|
||||
"True"
|
||||
],
|
||||
"since": "1.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "flushall with async",
|
||||
"command": [
|
||||
"flushall async"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "4.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "flushall with sync",
|
||||
"command": [
|
||||
"flushall sync"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "6.2.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "flushdb command",
|
||||
"command": [
|
||||
"flushdb"
|
||||
],
|
||||
"result": [
|
||||
"True"
|
||||
],
|
||||
"since": "1.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "flushdb with async",
|
||||
"command": [
|
||||
"flushdb async"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "4.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "flushdb with sync",
|
||||
"command": [
|
||||
"flushdb sync"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "6.2.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "module list command",
|
||||
"command": [
|
||||
"module list"
|
||||
],
|
||||
"result": [
|
||||
[]
|
||||
],
|
||||
"since": "4.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "replicaof command",
|
||||
"command": [
|
||||
"replicaof no one"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "5.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "role command",
|
||||
"command": [
|
||||
"role"
|
||||
],
|
||||
"result": [
|
||||
[
|
||||
"master",
|
||||
0,
|
||||
[]
|
||||
]
|
||||
],
|
||||
"since": "2.8.12"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "slaveof command",
|
||||
"command": [
|
||||
"slaveof no one"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "1.0.0"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "swapdb command",
|
||||
"command": [
|
||||
"swapdb 0 1"
|
||||
],
|
||||
"result": [
|
||||
"OK"
|
||||
],
|
||||
"since": "4.0.0"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -55,10 +55,10 @@ def report_result():
|
|||
for v, t in sorted(g_results.items()):
|
||||
print(f"version: {v}, total tests: {t.total}, passed: {t.passed}, "
|
||||
f"rate: {repr(t.passed / t.total * 100)}%")
|
||||
for v, t in sorted(g_results.items()):
|
||||
if args.show_failed and len(t.failed) != 0:
|
||||
print(f"This is failed tests for {v}:")
|
||||
print('\n'.join(str(fail) for fail in t.failed))
|
||||
exit(-1)
|
||||
|
||||
|
||||
def is_equal(left, right):
|
||||
|
@ -92,6 +92,8 @@ def trans_result_to_bytes(result):
|
|||
for k, v in result.items():
|
||||
result[k.encode()] = trans_result_to_bytes(v)
|
||||
del result[k]
|
||||
if type(result) is bool:
|
||||
return str(result).encode()
|
||||
return result
|
||||
|
||||
|
||||
|
@ -154,7 +156,7 @@ def run_test(test):
|
|||
trans_result_to_bytes(result)
|
||||
try:
|
||||
for idx, cmd in enumerate(command):
|
||||
ret = r.execute_command(trans_cmd(test, cmd))
|
||||
ret = trans_result_to_bytes(r.execute_command(trans_cmd(test, cmd)))
|
||||
if result[idx] != ret:
|
||||
test_failed(g_results[since], name, f"expected: {result[idx]}, result: {ret}")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue