Skip to content

Commit

Permalink
DiceDB#1029: json-numincrby-nummultby-toggle-forget-del migration and…
Browse files Browse the repository at this point in the history
… add integration testcases (DiceDB#1261)
  • Loading branch information
vpsinghg authored Nov 12, 2024
1 parent 51ccd04 commit cf14637
Show file tree
Hide file tree
Showing 27 changed files with 2,367 additions and 1,067 deletions.
40 changes: 20 additions & 20 deletions integration_tests/commands/async/deque_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,28 +455,28 @@ func TestLPOPCount(t *testing.T) {
{
name: "LPOP with count argument - valid, invalid, and edge cases",
cmds: []string{
"RPUSH k v1 v2 v3 v4",
"LPOP k 2",
"LLEN k",
"LPOP k 0",
"LLEN k",
"LPOP k 5",
"LLEN k",
"LPOP k -1",
"LPOP k abc",
"LLEN k",
"RPUSH k v1 v2 v3 v4",
"LPOP k 2",
"LLEN k",
"LPOP k 0",
"LLEN k",
"LPOP k 5",
"LLEN k",
"LPOP k -1",
"LPOP k abc",
"LLEN k",
},
expect: []any{
int64(4),
[]interface{}{"v1", "v2"},
int64(2),
[]interface{}{},
int64(2),
[]interface{}{"v3", "v4"},
int64(0),
"ERR value is out of range",
"ERR value is not an integer or out of range",
int64(0),
int64(4),
[]interface{}{"v1", "v2"},
int64(2),
[]interface{}{},
int64(2),
[]interface{}{"v3", "v4"},
int64(0),
"ERR value is out of range",
"ERR value is not an integer or out of range",
int64(0),
},
},
}
Expand Down
5 changes: 2 additions & 3 deletions integration_tests/commands/async/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,8 +1094,8 @@ func TestJsonObjLen(t *testing.T) {
cmd := tcase.commands[i]
out := tcase.expected[i]
result := FireCommand(conn, cmd)
assert.Equal(t, out, result);

assert.Equal(t, out, result)
}
})
}
Expand Down Expand Up @@ -1201,7 +1201,6 @@ func TestJSONNumIncrBy(t *testing.T) {
}
}


func TestJsonSTRAPPEND(t *testing.T) {
conn := getLocalConnection()
defer conn.Close()
Expand Down
17 changes: 8 additions & 9 deletions integration_tests/commands/http/deque_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,10 @@ func TestLPOPCount(t *testing.T) {
{Command: "RPUSH", Body: map[string]interface{}{"key": "k", "value": "v2"}},
{Command: "RPUSH", Body: map[string]interface{}{"key": "k", "value": "v3"}},
{Command: "RPUSH", Body: map[string]interface{}{"key": "k", "value": "v4"}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": 2}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": 2}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": -1}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": "abc"}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": 2}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": 2}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": -1}},
{Command: "LPOP", Body: map[string]interface{}{"key": "k", "value": "abc"}},
{Command: "LLEN", Body: map[string]interface{}{"key": "k"}},
},
expect: []any{
Expand All @@ -586,9 +586,9 @@ func TestLPOPCount(t *testing.T) {
float64(4),
[]interface{}{"v1", "v2"},
[]interface{}{"v3", "v4"},
"ERR value is out of range",
"ERR value is not an integer or out of range",
float64(0),
"ERR value is out of range",
"ERR value is not an integer or out of range",
float64(0),
},
},
}
Expand All @@ -598,9 +598,8 @@ func TestLPOPCount(t *testing.T) {
exec.FireCommand(HTTPCommand{Command: "DEL", Body: map[string]interface{}{"keys": []interface{}{"k"}}})
for i, cmd := range tc.cmds {
result, _ := exec.FireCommand(cmd)
assert.Equal(t, tc.expect[i], result, "Value mismatch for cmd %v", cmd)
assert.Equal(t, tc.expect[i], result, "Value mismatch for cmd %v", cmd)
}
})
}
}

2 changes: 1 addition & 1 deletion integration_tests/commands/http/json_arrpop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestJSONARRPOP(t *testing.T) {
for i, cmd := range tc.commands {
result, _ := exec.FireCommand(cmd)

jsonResult, isString := result.(string)
jsonResult, isString := result.(string)
if isString && testutils.IsJSONResponse(jsonResult) {
assert.JSONEq(t, tc.expected[i].(string), jsonResult)
continue
Expand Down
Loading

0 comments on commit cf14637

Please sign in to comment.