From 0b2cbf138e77f3dea2217ba3b950dc501ebeb2f2 Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 31 Aug 2023 11:36:35 +0800 Subject: [PATCH] Update sort_ro reply_schema to mention the null reply (#12534) Also added a test to cover this case, so this can cover the reply schemas check. (cherry picked from commit 9ce8c54d74f40bc5a70f210c2b14cf89c031ee10) --- src/commands/sort.json | 2 +- src/commands/sort_ro.json | 10 +++++++++- tests/unit/sort.tcl | 6 ++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/commands/sort.json b/src/commands/sort.json index 5e117c950..d5f651114 100644 --- a/src/commands/sort.json +++ b/src/commands/sort.json @@ -150,7 +150,7 @@ "type": "string" }, { - "description": "GET option is specified, but no object was found ", + "description": "GET option is specified, but no object was found", "type": "null" } ] diff --git a/src/commands/sort_ro.json b/src/commands/sort_ro.json index 8b32b17fa..04cc3c841 100644 --- a/src/commands/sort_ro.json +++ b/src/commands/sort_ro.json @@ -117,7 +117,15 @@ "description": "a list of sorted elements", "type": "array", "items": { - "type": "string" + "oneOf": [ + { + "type": "string" + }, + { + "description": "GET option is specified, but no object was found", + "type": "null" + } + ] } } } diff --git a/tests/unit/sort.tcl b/tests/unit/sort.tcl index d4927cf84..109f6615e 100644 --- a/tests/unit/sort.tcl +++ b/tests/unit/sort.tcl @@ -75,12 +75,14 @@ start_server { assert_equal [lsort -integer $result] [r sort tosort GET #] } {} {cluster:skip} - test "SORT GET " { +foreach command {SORT SORT_RO} { + test "$command GET " { r del foo - set res [r sort tosort GET foo] + set res [r $command tosort GET foo] assert_equal 16 [llength $res] foreach item $res { assert_equal {} $item } } {} {cluster:skip} +} test "SORT GET (key and hash) with sanity check" { set l1 [r sort tosort GET # GET weight_*]