Skip to content

Commit 9f5f59c

Browse files
committed
e2e: add tmux debug output on timeouts
1 parent a6949bd commit 9f5f59c

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

internal/e2e/helpers_test.go

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package e2e
22

33
import (
4+
"fmt"
45
"strings"
56
"testing"
67
"time"
@@ -39,7 +40,7 @@ func waitForAgentSessions(t *testing.T, opts tmux.Options, timeout time.Duration
3940
}
4041
time.Sleep(200 * time.Millisecond)
4142
}
42-
t.Fatalf("timeout waiting for agent sessions")
43+
t.Fatalf("timeout waiting for agent sessions\n%s", tmuxSessionDebug(opts))
4344
return nil
4445
}
4546

@@ -158,6 +159,35 @@ func waitForAssistantSessions(t *testing.T, opts tmux.Options, want map[string]b
158159
}
159160
time.Sleep(200 * time.Millisecond)
160161
}
161-
t.Fatalf("timeout waiting for assistant sessions: %v", want)
162+
t.Fatalf("timeout waiting for assistant sessions: %v\n%s", want, tmuxSessionDebug(opts))
162163
return nil
163164
}
165+
166+
func tmuxSessionDebug(opts tmux.Options) string {
167+
rows, err := tmux.SessionsWithTags(map[string]string{}, []string{
168+
"@amux",
169+
"@amux_type",
170+
"@amux_assistant",
171+
"@amux_workspace",
172+
"@amux_tab",
173+
}, opts)
174+
if err != nil {
175+
return fmt.Sprintf("tmux sessions: error=%v", err)
176+
}
177+
if len(rows) == 0 {
178+
return "tmux sessions: none"
179+
}
180+
lines := make([]string, 0, len(rows))
181+
for _, row := range rows {
182+
lines = append(lines, fmt.Sprintf(
183+
"%s amux=%q type=%q assistant=%q workspace=%q tab=%q",
184+
row.Name,
185+
row.Tags["@amux"],
186+
row.Tags["@amux_type"],
187+
row.Tags["@amux_assistant"],
188+
row.Tags["@amux_workspace"],
189+
row.Tags["@amux_tab"],
190+
))
191+
}
192+
return "tmux sessions:\n" + strings.Join(lines, "\n")
193+
}

internal/e2e/workspace_agent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/andyrewlee/amux/internal/tmux"
1010
)
1111

12-
const workspaceAgentTimeout = 20 * time.Second
12+
const workspaceAgentTimeout = 30 * time.Second
1313

1414
func TestWorkspaceCreateAgentTabStaysRunning(t *testing.T) {
1515
skipIfNoGit(t)

0 commit comments

Comments
 (0)