diff --git a/integration_tests/commands/http/command_getkeys_test.go b/integration_tests/commands/http/command_getkeys_test.go index 4fe4a0a6e..3ebb1074a 100644 --- a/integration_tests/commands/http/command_getkeys_test.go +++ b/integration_tests/commands/http/command_getkeys_test.go @@ -38,13 +38,14 @@ func TestCommandGetKeys(t *testing.T) { }, expected: []interface{}{[]interface{}{"1 2 3 4 5 6 7"}}, }, - { - name: "MSET command", - commands: []HTTPCommand{ - {Command: "COMMAND/GETKEYS", Body: map[string]interface{}{"key": "MSET", "keys": []interface{}{"key1 key2"}, "values": []interface{}{" val1 val2"}}}, - }, - expected: []interface{}{"ERR invalid command specified"}, - }, + // Skipping these tests until multishards cmds supported by http + //{ + // name: "MSET command", + // commands: []HTTPCommand{ + // {Command: "COMMAND/GETKEYS", Body: map[string]interface{}{"key": "MSET", "keys": []interface{}{"key1 key2"}, "values": []interface{}{" val1 val2"}}}, + // }, + // expected: []interface{}{"ERR invalid command specified"}, + //}, { name: "Expire command", commands: []HTTPCommand{ diff --git a/integration_tests/commands/http/set_data_cmd_test.go b/integration_tests/commands/http/set_data_cmd_test.go index dc5886460..adbd66bce 100644 --- a/integration_tests/commands/http/set_data_cmd_test.go +++ b/integration_tests/commands/http/set_data_cmd_test.go @@ -159,6 +159,7 @@ func TestSetDataCmd(t *testing.T) { assert_type: []string{"equal", "array", "equal", "array"}, expected: []interface{}{float64(3), []any{string("bar"), string("baz"), string("bax")}, float64(0), []any{string("bar"), string("baz"), string("bax")}}, }, + // Skipping these tests until multishards cmds supported by http //{ // name: "SADD & SDIFF", // commands: []HTTPCommand{ diff --git a/integration_tests/commands/http/setup.go b/integration_tests/commands/http/setup.go index 012b93ffe..24ef1aa00 100644 --- a/integration_tests/commands/http/setup.go +++ b/integration_tests/commands/http/setup.go @@ -6,13 +6,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/dicedb/dice/internal/server/httpws" "log" "net/http" "strings" "sync" "time" + "github.com/dicedb/dice/internal/server/httpws" + "github.com/dicedb/dice/config" derrors "github.com/dicedb/dice/internal/errors" "github.com/dicedb/dice/internal/querymanager" diff --git a/integration_tests/commands/resp/command_getkeys_test.go b/integration_tests/commands/resp/command_getkeys_test.go index dad07fe75..166079b4b 100644 --- a/integration_tests/commands/resp/command_getkeys_test.go +++ b/integration_tests/commands/resp/command_getkeys_test.go @@ -15,6 +15,7 @@ var getKeysTestCases = []struct { {"Get command", "get key", []interface{}{"key"}}, {"TTL command", "ttl key", []interface{}{"key"}}, {"Del command", "del 1 2 3 4 5 6", []interface{}{"1", "2", "3", "4", "5", "6"}}, + // TODO: Fix this for multi shard support //{"MSET command", "MSET key1 val1 key2 val2", []interface{}{"key1", "key2"}}, {"Expire command", "expire key time extra", []interface{}{"key"}}, {"Ping command", "ping", "ERR the command has no key arguments"}, diff --git a/integration_tests/commands/websocket/setup.go b/integration_tests/commands/websocket/setup.go index fd721aacc..281836f30 100644 --- a/integration_tests/commands/websocket/setup.go +++ b/integration_tests/commands/websocket/setup.go @@ -5,13 +5,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/dicedb/dice/internal/server/httpws" "log" "log/slog" "net/http" "sync" "time" + "github.com/dicedb/dice/internal/server/httpws" + "github.com/dicedb/dice/config" derrors "github.com/dicedb/dice/internal/errors" "github.com/dicedb/dice/internal/querymanager" diff --git a/internal/eval/eval.go b/internal/eval/eval.go index 590de98c7..7d85c9b90 100644 --- a/internal/eval/eval.go +++ b/internal/eval/eval.go @@ -3,11 +3,12 @@ package eval import ( "errors" "fmt" - "github.com/dicedb/dice/internal/object" "strconv" "strings" "time" + "github.com/dicedb/dice/internal/object" + "github.com/dicedb/dice/internal/sql" "github.com/dicedb/dice/config" diff --git a/internal/server/httpws/httpServer.go b/internal/server/httpws/httpServer.go index e20730f49..f04c42aec 100644 --- a/internal/server/httpws/httpServer.go +++ b/internal/server/httpws/httpServer.go @@ -5,7 +5,6 @@ import ( "context" "encoding/json" "fmt" - "github.com/dicedb/dice/internal/iothread" "hash/crc32" "log/slog" "net/http" @@ -13,6 +12,8 @@ import ( "sync" "time" + "github.com/dicedb/dice/internal/iothread" + "github.com/dicedb/dice/internal/eval" "github.com/dicedb/dice/internal/server/abstractserver" "github.com/dicedb/dice/internal/wal" @@ -386,7 +387,7 @@ func writeJSONResponse(writer http.ResponseWriter, response HTTPResponse, status } } -func writeErrorResponse(writer http.ResponseWriter, status int, message string, logMessage string, logFields ...any) { +func writeErrorResponse(writer http.ResponseWriter, status int, message, logMessage string, logFields ...any) { responseJSON, _ := json.Marshal(HTTPResponse{Status: HTTPStatusError, Data: message}) writer.Header().Set("Content-Type", "application/json") writer.WriteHeader(status) diff --git a/internal/server/httpws/redisCmdAdapter.go b/internal/server/httpws/redisCmdAdapter.go index 4f82a6f0d..577a73e68 100644 --- a/internal/server/httpws/redisCmdAdapter.go +++ b/internal/server/httpws/redisCmdAdapter.go @@ -5,13 +5,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/dicedb/dice/internal/server/utils" "io" "net/http" "regexp" "strconv" "strings" + "github.com/dicedb/dice/internal/server/utils" + "github.com/dicedb/dice/internal/cmd" diceerrors "github.com/dicedb/dice/internal/errors" ) diff --git a/internal/server/httpws/websocketServer.go b/internal/server/httpws/websocketServer.go index 02a9c6c5a..bc090ff2b 100644 --- a/internal/server/httpws/websocketServer.go +++ b/internal/server/httpws/websocketServer.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/dicedb/dice/internal/iothread" "log/slog" "net" "net/http" @@ -15,6 +14,8 @@ import ( "syscall" "time" + "github.com/dicedb/dice/internal/iothread" + "github.com/dicedb/dice/internal/server/abstractserver" "github.com/dicedb/dice/internal/wal" diff --git a/main.go b/main.go index 930f2aa0d..0eea883a5 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "github.com/dicedb/dice/internal/server/httpws" "log/slog" "net/http" "os" @@ -16,6 +15,8 @@ import ( "syscall" "time" + "github.com/dicedb/dice/internal/server/httpws" + "github.com/dicedb/dice/internal/cli" "github.com/dicedb/dice/internal/logger" "github.com/dicedb/dice/internal/server/abstractserver"