chore: fix build break (#483)

* fix(sling_test): update test for cook dir change

The cook command no longer needs database context and runs from cwd,
not the target rig directory. Update test to match this behavior
change from bd2a5ab5.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(tests): skip tests requiring missing binaries, handle --allow-stale

- Add skipIfAgentBinaryMissing helper to skip tests when codex/gemini
  binaries aren't available in the test environment
- Update rig manager test stub to handle --allow-stale flag

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: julianknutsen <julianknutsen@users.noreply.github>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen
2026-01-14 06:13:35 +00:00
committed by GitHub
parent 08755f62cd
commit 80af0547ea
3 changed files with 21 additions and 3 deletions

View File

@@ -328,9 +328,7 @@ exit 0
switch {
case strings.Contains(args, " cook "):
gotCook = true
if dir != wantDir {
t.Fatalf("bd cook ran in %q, want %q (args: %q)", dir, wantDir, args)
}
// cook doesn't need database context, runs from cwd
case strings.Contains(args, " mol wisp "):
gotWisp = true
if dir != wantDir {

View File

@@ -2,6 +2,7 @@ package config
import (
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
@@ -10,6 +11,18 @@ import (
"github.com/steveyegge/gastown/internal/constants"
)
// skipIfAgentBinaryMissing skips the test if any of the specified agent binaries
// are not found in PATH. This allows tests that depend on specific agents to be
// skipped in environments where those agents aren't installed.
func skipIfAgentBinaryMissing(t *testing.T, agents ...string) {
t.Helper()
for _, agent := range agents {
if _, err := exec.LookPath(agent); err != nil {
t.Skipf("skipping test: agent binary %q not found in PATH", agent)
}
}
}
func TestTownConfigRoundTrip(t *testing.T) {
t.Parallel()
dir := t.TempDir()
@@ -1196,6 +1209,7 @@ func TestBuildStartupCommand_UsesRigAgentWhenRigPathProvided(t *testing.T) {
}
func TestBuildStartupCommand_UsesRoleAgentsFromTownSettings(t *testing.T) {
skipIfAgentBinaryMissing(t, "gemini", "codex")
t.Parallel()
townRoot := t.TempDir()
rigPath := filepath.Join(townRoot, "testrig")
@@ -1247,6 +1261,7 @@ func TestBuildStartupCommand_UsesRoleAgentsFromTownSettings(t *testing.T) {
}
func TestBuildStartupCommand_RigRoleAgentsOverridesTownRoleAgents(t *testing.T) {
skipIfAgentBinaryMissing(t, "gemini", "codex")
t.Parallel()
townRoot := t.TempDir()
rigPath := filepath.Join(townRoot, "testrig")
@@ -1280,6 +1295,7 @@ func TestBuildStartupCommand_RigRoleAgentsOverridesTownRoleAgents(t *testing.T)
}
func TestBuildAgentStartupCommand_UsesRoleAgents(t *testing.T) {
skipIfAgentBinaryMissing(t, "codex")
t.Parallel()
townRoot := t.TempDir()
rigPath := filepath.Join(townRoot, "testrig")
@@ -1937,6 +1953,7 @@ func TestLookupAgentConfigWithRigSettings(t *testing.T) {
}
func TestResolveRoleAgentConfig(t *testing.T) {
skipIfAgentBinaryMissing(t, "gemini", "codex")
t.Parallel()
townRoot := t.TempDir()
rigPath := filepath.Join(townRoot, "testrig")

View File

@@ -460,6 +460,9 @@ fi
if [[ "$1" == "--no-daemon" ]]; then
shift
fi
if [[ "$1" == "--allow-stale" ]]; then
shift
fi
cmd="$1"
shift
case "$cmd" in