feat: runtime manager

This commit is contained in:
Ilia Denisov
2026-04-28 20:39:18 +02:00
committed by GitHub
parent e0a99b346b
commit a7cee15115
289 changed files with 45660 additions and 2207 deletions
@@ -7,8 +7,8 @@ import (
"testing"
"time"
"galaxy/lobby/internal/adapters/gamestub"
"galaxy/lobby/internal/adapters/racenamestub"
"galaxy/lobby/internal/adapters/gameinmem"
"galaxy/lobby/internal/adapters/racenameinmem"
"galaxy/lobby/internal/domain/common"
"galaxy/lobby/internal/domain/game"
"galaxy/lobby/internal/ports"
@@ -28,17 +28,17 @@ func silentLogger() *slog.Logger {
// race-name directory stub and the in-process game store.
type fixture struct {
now time.Time
directory *racenamestub.Directory
games *gamestub.Store
directory *racenameinmem.Directory
games *gameinmem.Store
service *listmyracenames.Service
}
func newFixture(t *testing.T) *fixture {
t.Helper()
now := time.Date(2026, 4, 25, 12, 0, 0, 0, time.UTC)
directory, err := racenamestub.NewDirectory(racenamestub.WithClock(func() time.Time { return now }))
directory, err := racenameinmem.NewDirectory(racenameinmem.WithClock(func() time.Time { return now }))
require.NoError(t, err)
games := gamestub.NewStore()
games := gameinmem.NewStore()
svc, err := listmyracenames.NewService(listmyracenames.Dependencies{
Directory: directory,
Games: games,
@@ -217,9 +217,9 @@ func TestHandleSortByTimestamp(t *testing.T) {
const userID = "user-sort"
now := time.Date(2026, 4, 25, 12, 0, 0, 0, time.UTC)
clock := now
directory, err := racenamestub.NewDirectory(racenamestub.WithClock(func() time.Time { return clock }))
directory, err := racenameinmem.NewDirectory(racenameinmem.WithClock(func() time.Time { return clock }))
require.NoError(t, err)
games := gamestub.NewStore()
games := gameinmem.NewStore()
svc, err := listmyracenames.NewService(listmyracenames.Dependencies{
Directory: directory,
Games: games,
@@ -281,9 +281,9 @@ func TestHandleSortByTimestamp(t *testing.T) {
func TestNewServiceRejectsMissingDeps(t *testing.T) {
t.Parallel()
directory, err := racenamestub.NewDirectory()
directory, err := racenameinmem.NewDirectory()
require.NoError(t, err)
games := gamestub.NewStore()
games := gameinmem.NewStore()
_, err = listmyracenames.NewService(listmyracenames.Dependencies{
Games: games,
@@ -299,4 +299,4 @@ func TestNewServiceRejectsMissingDeps(t *testing.T) {
// Sanity guard so a future port refactor that drops the user-keyed
// indexes immediately breaks the test build instead of silently
// regressing the no-full-scan invariant.
var _ ports.RaceNameDirectory = (*racenamestub.Directory)(nil)
var _ ports.RaceNameDirectory = (*racenameinmem.Directory)(nil)