Files
go-cart-actor/packet-queue_test.go
matst80 fd9a66d193
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m48s
limit queue
2024-11-10 12:50:29 +01:00

33 lines
666 B
Go

package main
import (
"testing"
"time"
)
func TestQueue(t *testing.T) {
localPool := NewGrainLocalPool(100, time.Minute, func(id CartId) (*CartGrain, error) {
return &CartGrain{
Id: id,
storageMessages: []Message{},
Items: []CartItem{},
TotalPrice: 0,
}, nil
})
pool, err := NewSyncedPool(localPool, "localhost", nil)
if err != nil {
t.Errorf("Error creating pool: %v", err)
}
err = pool.AddRemote("localhost")
if err != nil {
t.Errorf("Error adding remote: %v", err)
}
r := pool.remotes[0]
if len(r.PacketQueue.Packets) != 1 {
t.Errorf("Expected 1 packet, got %d", len(r.PacketQueue.Packets))
}
}