update status data
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m20s

This commit is contained in:
matst80
2024-11-13 23:39:28 +01:00
parent ababb55b17
commit 7795fc9c39
2 changed files with 20 additions and 10 deletions

View File

@@ -307,10 +307,6 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
c.mu.Unlock()
}
result, err := json.Marshal(c)
return &FrameWithPayload{
Frame: Frame{
StatusCode: 200,
},
Payload: result,
}, err
msg := MakeFrameWithPayload(RemoteHandleMutationReply, 200, result)
return &msg, err
}

View File

@@ -1,8 +1,11 @@
package main
import (
"log"
"testing"
"time"
messages "git.tornberg.me/go-cart-actor/proto"
)
func TestConnection(t *testing.T) {
@@ -33,14 +36,25 @@ func TestConnection(t *testing.T) {
pool.AddRemote("127.0.0.1")
go pool.Negotiate()
data, err := pool.Get(ToCartId("kalle"))
msg := Message{
Type: AddItemType,
//TimeStamp: time.Now().Unix(),
Content: &messages.AddItem{
Quantity: 1,
Price: 100,
Sku: "123",
Name: "Test",
Image: "Test",
},
}
data, err := pool.Process(ToCartId("kalle"), msg)
if err != nil {
t.Errorf("Error getting data: %v", err)
}
if data == nil {
t.Errorf("Expected data, got nil")
if data.StatusCode != 200 {
t.Errorf("Expected 200")
}
log.Println(data)
time.Sleep(2 * time.Millisecond)
data, err = pool.Get(ToCartId("kalle"))
if err != nil {