update status data
This commit is contained in:
@@ -307,10 +307,6 @@ func (c *CartGrain) HandleMessage(message *Message, isReplay bool) (*FrameWithPa
|
|||||||
c.mu.Unlock()
|
c.mu.Unlock()
|
||||||
}
|
}
|
||||||
result, err := json.Marshal(c)
|
result, err := json.Marshal(c)
|
||||||
return &FrameWithPayload{
|
msg := MakeFrameWithPayload(RemoteHandleMutationReply, 200, result)
|
||||||
Frame: Frame{
|
return &msg, err
|
||||||
StatusCode: 200,
|
|
||||||
},
|
|
||||||
Payload: result,
|
|
||||||
}, err
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
messages "git.tornberg.me/go-cart-actor/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConnection(t *testing.T) {
|
func TestConnection(t *testing.T) {
|
||||||
@@ -33,14 +36,25 @@ func TestConnection(t *testing.T) {
|
|||||||
pool.AddRemote("127.0.0.1")
|
pool.AddRemote("127.0.0.1")
|
||||||
|
|
||||||
go pool.Negotiate()
|
go pool.Negotiate()
|
||||||
|
msg := Message{
|
||||||
data, err := pool.Get(ToCartId("kalle"))
|
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 {
|
if err != nil {
|
||||||
t.Errorf("Error getting data: %v", err)
|
t.Errorf("Error getting data: %v", err)
|
||||||
}
|
}
|
||||||
if data == nil {
|
if data.StatusCode != 200 {
|
||||||
t.Errorf("Expected data, got nil")
|
t.Errorf("Expected 200")
|
||||||
}
|
}
|
||||||
|
log.Println(data)
|
||||||
time.Sleep(2 * time.Millisecond)
|
time.Sleep(2 * time.Millisecond)
|
||||||
data, err = pool.Get(ToCartId("kalle"))
|
data, err = pool.Get(ToCartId("kalle"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user