Fixing unit tests on windows (#813)

* Add Windows stub for orphan cleanup

* Fix account switch tests on Windows

* Make query session events test portable

* Disable beads daemon in query session events test

* Add Windows bd stubs for sling tests

* Make expandOutputPath test OS-agnostic

* Make role_agents test Windows-friendly

* Make config path tests OS-agnostic

* Make HealthCheckStateFile test OS-agnostic

* Skip orphan process check on Windows

* Normalize sparse checkout detail paths

* Make dog path tests OS-agnostic

* Fix bare repo refspec config on Windows

* Add Windows process detection for locks

* Add Windows CI workflow

* Make mail path tests OS-agnostic

* Skip plugin file mode test on Windows

* Skip tmux-dependent polecat tests on Windows

* Normalize polecat paths and AGENTS.md content

* Make beads init failure test Windows-friendly

* Skip rig agent bead init test on Windows

* Make XDG path tests OS-agnostic

* Make exec tests portable on Windows

* Adjust atomic write tests for Windows

* Make wisp tests Windows-friendly

* Make workspace find tests OS-agnostic

* Fix Windows rig add integration test

* Make sling var logging Windows-friendly

* Fix sling attached molecule update ordering

---------

Co-authored-by: Johann Dirry <johann.dirry@microsea.at>
This commit is contained in:
Johann Dirry
2026-01-20 23:17:35 +01:00
committed by GitHub
parent b8a679c30c
commit 3d5a66f850
32 changed files with 626 additions and 203 deletions

View File

@@ -4,6 +4,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
@@ -809,7 +810,7 @@ func TestMessagingConfigPath(t *testing.T) {
t.Parallel()
path := MessagingConfigPath("/home/user/gt")
expected := "/home/user/gt/config/messaging.json"
if path != expected {
if filepath.ToSlash(path) != expected {
t.Errorf("MessagingConfigPath = %q, want %q", path, expected)
}
}
@@ -1217,6 +1218,13 @@ func TestBuildStartupCommand_UsesRoleAgentsFromTownSettings(t *testing.T) {
binDir := t.TempDir()
for _, name := range []string{"gemini", "codex"} {
if runtime.GOOS == "windows" {
path := filepath.Join(binDir, name+".cmd")
if err := os.WriteFile(path, []byte("@echo off\r\nexit /b 0\r\n"), 0644); err != nil {
t.Fatalf("write %s stub: %v", name, err)
}
continue
}
path := filepath.Join(binDir, name)
if err := os.WriteFile(path, []byte("#!/bin/sh\nexit 0\n"), 0755); err != nil {
t.Fatalf("write %s stub: %v", name, err)
@@ -1595,7 +1603,7 @@ func TestDaemonPatrolConfigPath(t *testing.T) {
for _, tt := range tests {
t.Run(tt.townRoot, func(t *testing.T) {
path := DaemonPatrolConfigPath(tt.townRoot)
if path != tt.expected {
if filepath.ToSlash(path) != filepath.ToSlash(tt.expected) {
t.Errorf("DaemonPatrolConfigPath(%q) = %q, want %q", tt.townRoot, path, tt.expected)
}
})
@@ -2529,7 +2537,7 @@ func TestEscalationConfigPath(t *testing.T) {
path := EscalationConfigPath("/home/user/gt")
expected := "/home/user/gt/settings/escalation.json"
if path != expected {
if filepath.ToSlash(path) != expected {
t.Errorf("EscalationConfigPath = %q, want %q", path, expected)
}
}