mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
feat(multiplayer): refresh allocator ready servers
This commit is contained in:
@@ -71,6 +71,13 @@ func TestPostgreSQLAllocatorClaimReplayAndCapacityFence(t *testing.T) {
|
||||
if allocation.ServerID != "allocator-server-a" || allocation.State != domain.ServerAllocated {
|
||||
t.Fatalf("allocation=%+v", allocation)
|
||||
}
|
||||
if err := RegisterReadyServer(ctx, db, servers[1], now.Add(time.Second)); err != nil {
|
||||
t.Fatalf("stale Ready projection: %v", err)
|
||||
}
|
||||
var lifecycle string
|
||||
if err := db.QueryRowContext(ctx, `SELECT state FROM game_servers WHERE server_id = 'allocator-server-a'`).Scan(&lifecycle); err != nil || lifecycle != "ALLOCATED" {
|
||||
t.Fatalf("stale Ready projection reopened allocation state=%q err=%v", lifecycle, err)
|
||||
}
|
||||
replay, err := ClaimAllocation(ctx, db, request, now.Add(time.Second))
|
||||
if err != nil || replay.ServerID != allocation.ServerID || !replay.AllocatedAt.Equal(allocation.AllocatedAt) {
|
||||
t.Fatalf("replay=%+v err=%v", replay, err)
|
||||
|
||||
Reference in New Issue
Block a user