diff --git a/tests/runtime_test.go b/tests/runtime_test.go index fe695a4d784713d4a81473bdd9587b4fc086dbfa..77fa0a8e6de511936ead1221d422c55b71e9cd28 100644 --- a/tests/runtime_test.go +++ b/tests/runtime_test.go @@ -236,7 +236,7 @@ nakama.register_rpc(test.printWorld, "helloworld") payload := "\"Hello World\"" client := &http.Client{} - request, _ := http.NewRequest("POST", "http://localhost:7349/v2/rpc/helloworld?http_key=defaultkey", strings.NewReader(payload)) + request, _ := http.NewRequest("POST", "http://localhost:7350/v2/rpc/helloworld?http_key=defaultkey", strings.NewReader(payload)) request.Header.Add("Content-Type", "Application/JSON") res, err := client.Do(request) if err != nil { @@ -483,6 +483,11 @@ nk.notification_send(user_id, subject, content, code, "", false) func TestRuntimeWalletWrite(t *testing.T) { modules := new(sync.Map) + + db := NewDB(t) + uid := uuid.FromStringOrNil("95f05d94-cc66-445a-b4d1-9e262662cf79") + InsertUser(t, db, uid) + writeLuaModule(modules, "test", ` local nk = require("nakama") @@ -491,7 +496,7 @@ local content = { } local user_id = "95f05d94-cc66-445a-b4d1-9e262662cf79" -- who to send -nk.wallet_write(user_id, content) +nk.wallet_update(user_id, content) `) rp := vm(t, modules) @@ -614,7 +619,7 @@ func TestRuntimeReqAfterHook(t *testing.T) { writeLuaModule(modules, "test", ` local nakama = require("nakama") function after_storage_write(ctx, payload) - nakama.wallet_write(ctx.user_id, {gem = 10}) + nakama.wallet_update(ctx.user_id, {gem = 10}) return payload end nakama.register_req_after(after_storage_write, "WriteStorageObjects") @@ -661,7 +666,7 @@ func TestRuntimeRTBeforeHook(t *testing.T) { writeLuaModule(modules, "test", ` local nakama = require("nakama") function before_match_create(ctx, payload) - nakama.wallet_write(ctx.user_id, {gem = 20}) + nakama.wallet_update(ctx.user_id, {gem = 20}) return payload end nakama.register_rt_before(before_match_create, "MatchCreate") @@ -712,7 +717,7 @@ end nakama.register_rt_before(before_match_create, "MatchCreate") function after_match_create(ctx, payload) - nakama.wallet_write(ctx.user_id, {gem = 30}) + nakama.wallet_update(ctx.user_id, {gem = 30}) return payload end nakama.register_rt_after(after_match_create, "MatchCreate") diff --git a/tests/util.go b/tests/util.go index c5a2c4ab98e1f48a3fb924cd792c49e4241e07f1..f69c4826d8f69168f2196d99e52330e519b0d19e 100644 --- a/tests/util.go +++ b/tests/util.go @@ -37,8 +37,8 @@ import ( ) var ( - config = server.NewConfig() logger = server.NewConsoleLogger(os.Stdout, true) + config = server.NewConfig(logger) jsonpbMarshaler = &jsonpb.Marshaler{ EnumsAsInts: true, EmitDefaults: false, @@ -133,7 +133,7 @@ func NewSession(t *testing.T, customID string) (*grpc.ClientConn, api.NakamaClie outgoingCtx := metadata.NewOutgoingContext(ctx, metadata.New(map[string]string{ "authorization": "Basic " + base64.StdEncoding.EncodeToString([]byte("defaultkey:")), })) - conn, err := grpc.DialContext(outgoingCtx, "localhost:7350", grpc.WithInsecure()) + conn, err := grpc.DialContext(outgoingCtx, "localhost:7349", grpc.WithInsecure()) if err != nil { t.Fatal(err) } @@ -160,7 +160,7 @@ func NewAuthenticatedAPIClient(t *testing.T, customID string) (*grpc.ClientConn, outgoingCtx := metadata.NewOutgoingContext(ctx, metadata.New(map[string]string{ "authorization": "Bearer " + session.Token, })) - conn, err := grpc.DialContext(outgoingCtx, "localhost:7350", grpc.WithInsecure()) + conn, err := grpc.DialContext(outgoingCtx, "localhost:7349", grpc.WithInsecure()) if err != nil { t.Fatal(err) }