Files
gastown/internal/swarm/manager_test.go
Steve Yegge f7393b6cdb refactor: Remove in-memory swarms map, make Manager stateless
The swarm Manager was maintaining an in-memory map of swarms that was
never persisted and duplicated state from beads. This caused stale state
after restarts and confusion about source of truth.

Changes:
- Remove swarms map from Manager (now stateless)
- Add LoadSwarm() that queries beads for swarm state
- Refactor all methods to use LoadSwarm() instead of in-memory lookup
- Discover workers from assigned tasks in beads
- Remove obsolete unit tests that tested in-memory behavior
- Keep type/state tests that do not need beads

The E2E test (gt-kc7yj.4) now covers the beads integration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 17:12:30 -08:00

29 lines
517 B
Go

package swarm
import (
"testing"
"github.com/steveyegge/gastown/internal/rig"
)
func TestNewManager(t *testing.T) {
r := &rig.Rig{
Name: "test-rig",
Path: "/tmp/test-rig",
}
m := NewManager(r)
if m == nil {
t.Fatal("NewManager returned nil")
}
if m.rig != r {
t.Error("Manager rig not set correctly")
}
if m.workDir != r.Path {
t.Errorf("workDir = %q, want %q", m.workDir, r.Path)
}
}
// Note: Most swarm tests require integration with beads.
// See gt-kc7yj.4 for the E2E integration test.