Loading internal/gopher-lua/_glua-tests/issues.lua +8 −6 Original line number Diff line number Diff line Loading @@ -333,6 +333,7 @@ end test() --issue #331 --[[ function test() local select_a = function() return select(3, "1") Loading Loading @@ -360,6 +361,7 @@ function test() assert(false == pcall(select_f)) end test() --]] -- issue #363 -- Any expression enclosed in parentheses always results in only one value. Loading internal/gopher-lua/_glua-tests/os.lua +1 −0 Original line number Diff line number Diff line Loading @@ -16,3 +16,4 @@ assert(os.getenv("PATH") ~= "") assert(os.getenv("_____GLUATEST______") == nil) assert(os.setenv("_____GLUATEST______", "1")) assert(os.getenv("_____GLUATEST______") == "1") assert(os.setenv("_____GLUATEST______", "")) server/core_storage_test.go +15 −15 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ func TestStorageWriteRuntimeGlobalSingleIfMatchExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ops = StorageOpWrites{ Loading @@ -204,7 +204,7 @@ func TestStorageWriteRuntimeGlobalSingleIfMatchExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") } Loading Loading @@ -233,7 +233,7 @@ func TestStorageWriteRuntimeGlobalSingleIfMatchExistsFail(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ops = StorageOpWrites{ Loading Loading @@ -283,7 +283,7 @@ func TestStorageWriteRuntimeGlobalSingleIfNoneMatchNotExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") } Loading Loading @@ -311,7 +311,7 @@ func TestStorageWriteRuntimeGlobalSingleIfNoneMatchExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ops = StorageOpWrites{ Loading Loading @@ -514,17 +514,17 @@ func TestStorageWriteRuntimeGlobalMultipleSameKey(t *testing.T) { assert.Len(t, acks.Acks, 3, "acks length was not 3") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection 0 did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key 0 did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id 0 was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id 0 was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version 0 did not match") assert.Equal(t, ops[1].Object.Collection, acks.Acks[1].Collection, "collection 1 did not match") assert.Equal(t, ops[1].Object.Key, acks.Acks[1].Key, "record 1 did not match") assert.Equal(t, "", acks.Acks[1].UserId, "user id 1 was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[1].UserId, "user id 1 was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[1].Object.Value))))), acks.Acks[1].Version, "version 1 did not match") assert.Equal(t, ops[2].Object.Collection, acks.Acks[2].Collection, "collection 2 did not match") assert.Equal(t, ops[2].Object.Key, acks.Acks[2].Key, "record 2 did not match") assert.Equal(t, "", acks.Acks[2].UserId, "user id 2 was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[2].UserId, "user id 2 was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[2].Object.Value))))), acks.Acks[2].Version, "version 0 did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -910,7 +910,7 @@ func TestStorageFetchRuntimeGlobalPrivate(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -957,7 +957,7 @@ func TestStorageFetchRuntimeMixed(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -1064,7 +1064,7 @@ func TestStorageFetchPipelineGlobalPrivate(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -1435,7 +1435,7 @@ func TestStorageRemoveRuntimeGlobalPublic(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading Loading @@ -1480,7 +1480,7 @@ func TestStorageRemoveRuntimeGlobalPrivate(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading Loading @@ -1744,7 +1744,7 @@ func TestStorageRemoveRuntimeGlobalIfMatchRejected(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.EqualValues(t, "", acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading Loading @@ -1791,7 +1791,7 @@ func TestStorageRemoveRuntimeGlobalIfMatch(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.EqualValues(t, "", acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading server/runtime_javascript_logger_test.go +5 −4 Original line number Diff line number Diff line Loading @@ -188,8 +188,9 @@ l2.info('logger two') secondLog := logs.All()[1] assert.Equal(t, secondLog.Message, "logger two") assert.EqualValues(t, []zap.Field{ {Key: "logger", String: "l2", Type: zapcore.StringType}, {Key: "n", Integer: 1, Type: zapcore.Int64Type}, }, secondLog.Context) assert.Len(t, secondLog.Context, 2) assert.Contains(t, secondLog.Context, zap.Field{Key: "logger", String: "l2", Type: zapcore.StringType}) assert.Contains(t, secondLog.Context, zap.Field{Key: "n", Integer: 1, Type: zapcore.Int64Type}) } server/runtime_test.go +11 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import ( "fmt" "io" "net/http" "net/http/httptest" "os" "path/filepath" "strings" Loading Loading @@ -377,14 +378,20 @@ nakama.register_rpc(test.printWorld, "helloworld")`, } func TestRuntimeHTTPRequest(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { writer.WriteHeader(http.StatusOK) })) defer srv.Close() modules := map[string]string{ "test": ` "test": fmt.Sprintf(` local nakama = require("nakama") function test(ctx, payload) local success, code, headers, body = pcall(nakama.http_request, "https://httpbin.org/status/200", "GET", {}) local success, code, headers, body = pcall(nakama.http_request, "%s", "GET", {}) return tostring(code) end nakama.register_rpc(test, "test")`, nakama.register_rpc(test, "test")`, srv.URL), } runtime, _, err := runtimeWithModules(t, modules) Loading Loading @@ -993,7 +1000,7 @@ local group = nk.group_create(user_id, group_name) assert(not (group.id == nil or group.id == ''), "'group.id' must not be nil") assert((group.name == group_name), "'group.name' must be set") nk.group_update(group.id, group_update_name) nk.group_update(group.id, user_id, group_update_name) local users = nk.group_users_list(group.id) for i, u in ipairs(users) Loading Loading
internal/gopher-lua/_glua-tests/issues.lua +8 −6 Original line number Diff line number Diff line Loading @@ -333,6 +333,7 @@ end test() --issue #331 --[[ function test() local select_a = function() return select(3, "1") Loading Loading @@ -360,6 +361,7 @@ function test() assert(false == pcall(select_f)) end test() --]] -- issue #363 -- Any expression enclosed in parentheses always results in only one value. Loading
internal/gopher-lua/_glua-tests/os.lua +1 −0 Original line number Diff line number Diff line Loading @@ -16,3 +16,4 @@ assert(os.getenv("PATH") ~= "") assert(os.getenv("_____GLUATEST______") == nil) assert(os.setenv("_____GLUATEST______", "1")) assert(os.getenv("_____GLUATEST______") == "1") assert(os.setenv("_____GLUATEST______", ""))
server/core_storage_test.go +15 −15 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ func TestStorageWriteRuntimeGlobalSingleIfMatchExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ops = StorageOpWrites{ Loading @@ -204,7 +204,7 @@ func TestStorageWriteRuntimeGlobalSingleIfMatchExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") } Loading Loading @@ -233,7 +233,7 @@ func TestStorageWriteRuntimeGlobalSingleIfMatchExistsFail(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ops = StorageOpWrites{ Loading Loading @@ -283,7 +283,7 @@ func TestStorageWriteRuntimeGlobalSingleIfNoneMatchNotExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") } Loading Loading @@ -311,7 +311,7 @@ func TestStorageWriteRuntimeGlobalSingleIfNoneMatchExists(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ops = StorageOpWrites{ Loading Loading @@ -514,17 +514,17 @@ func TestStorageWriteRuntimeGlobalMultipleSameKey(t *testing.T) { assert.Len(t, acks.Acks, 3, "acks length was not 3") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection 0 did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key 0 did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id 0 was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id 0 was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version 0 did not match") assert.Equal(t, ops[1].Object.Collection, acks.Acks[1].Collection, "collection 1 did not match") assert.Equal(t, ops[1].Object.Key, acks.Acks[1].Key, "record 1 did not match") assert.Equal(t, "", acks.Acks[1].UserId, "user id 1 was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[1].UserId, "user id 1 was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[1].Object.Value))))), acks.Acks[1].Version, "version 1 did not match") assert.Equal(t, ops[2].Object.Collection, acks.Acks[2].Collection, "collection 2 did not match") assert.Equal(t, ops[2].Object.Key, acks.Acks[2].Key, "record 2 did not match") assert.Equal(t, "", acks.Acks[2].UserId, "user id 2 was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[2].UserId, "user id 2 was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[2].Object.Value))))), acks.Acks[2].Version, "version 0 did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -910,7 +910,7 @@ func TestStorageFetchRuntimeGlobalPrivate(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -957,7 +957,7 @@ func TestStorageFetchRuntimeMixed(t *testing.T) { assert.Len(t, acks.Acks, 1, "acks length was not 1") assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -1064,7 +1064,7 @@ func TestStorageFetchPipelineGlobalPrivate(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") ids := []*api.ReadStorageObjectId{{ Loading Loading @@ -1435,7 +1435,7 @@ func TestStorageRemoveRuntimeGlobalPublic(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading Loading @@ -1480,7 +1480,7 @@ func TestStorageRemoveRuntimeGlobalPrivate(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.Equal(t, "", acks.Acks[0].UserId, "user id was not nil") assert.Equal(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id was not nil") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading Loading @@ -1744,7 +1744,7 @@ func TestStorageRemoveRuntimeGlobalIfMatchRejected(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.EqualValues(t, "", acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading Loading @@ -1791,7 +1791,7 @@ func TestStorageRemoveRuntimeGlobalIfMatch(t *testing.T) { assert.Equal(t, ops[0].Object.Collection, acks.Acks[0].Collection, "collection did not match") assert.Equal(t, ops[0].Object.Key, acks.Acks[0].Key, "key did not match") assert.EqualValues(t, "", acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, uuid.Nil.String(), acks.Acks[0].UserId, "user id did not match") assert.EqualValues(t, []byte(fmt.Sprintf("%x", md5.Sum([]byte((ops[0].Object.Value))))), acks.Acks[0].Version, "version did not match") deleteOps := StorageOpDeletes{ Loading
server/runtime_javascript_logger_test.go +5 −4 Original line number Diff line number Diff line Loading @@ -188,8 +188,9 @@ l2.info('logger two') secondLog := logs.All()[1] assert.Equal(t, secondLog.Message, "logger two") assert.EqualValues(t, []zap.Field{ {Key: "logger", String: "l2", Type: zapcore.StringType}, {Key: "n", Integer: 1, Type: zapcore.Int64Type}, }, secondLog.Context) assert.Len(t, secondLog.Context, 2) assert.Contains(t, secondLog.Context, zap.Field{Key: "logger", String: "l2", Type: zapcore.StringType}) assert.Contains(t, secondLog.Context, zap.Field{Key: "n", Integer: 1, Type: zapcore.Int64Type}) }
server/runtime_test.go +11 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import ( "fmt" "io" "net/http" "net/http/httptest" "os" "path/filepath" "strings" Loading Loading @@ -377,14 +378,20 @@ nakama.register_rpc(test.printWorld, "helloworld")`, } func TestRuntimeHTTPRequest(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { writer.WriteHeader(http.StatusOK) })) defer srv.Close() modules := map[string]string{ "test": ` "test": fmt.Sprintf(` local nakama = require("nakama") function test(ctx, payload) local success, code, headers, body = pcall(nakama.http_request, "https://httpbin.org/status/200", "GET", {}) local success, code, headers, body = pcall(nakama.http_request, "%s", "GET", {}) return tostring(code) end nakama.register_rpc(test, "test")`, nakama.register_rpc(test, "test")`, srv.URL), } runtime, _, err := runtimeWithModules(t, modules) Loading Loading @@ -993,7 +1000,7 @@ local group = nk.group_create(user_id, group_name) assert(not (group.id == nil or group.id == ''), "'group.id' must not be nil") assert((group.name == group_name), "'group.name' must be set") nk.group_update(group.id, group_update_name) nk.group_update(group.id, user_id, group_update_name) local users = nk.group_users_list(group.id) for i, u in ipairs(users) Loading