test(ci): stabilize cross-platform async coverage
- commit
- 145923258844040bc7691afef7257234fbc1523b
- author
- brice · · 2026-08-08 04:22 UTC
- parent
- 9265275
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +18 -8
M packages/agent/modes/session_dialog_test.go +8 -6
| @@ -13,6 +13,8 @@ import ( | |||
| 13 | 13 | "github.com/bnema/zut/packages/tui" | |
| 14 | 14 | ) | |
| 15 | 15 | ||
| 16 | + | const sessionDialogTestTimeout = 10 * time.Second | |
| 17 | + | ||
| 16 | 18 | func TestFormatSessionRowPlainSanitizesControlBytes(t *testing.T) { | |
| 17 | 19 | row := formatSessionRowPlain(core.SessionSummary{ | |
| 18 | 20 | Provider: "test\x1b]0;bad\a", | |
| @@ -149,12 +151,12 @@ func TestSessionDialogCancellationDoesNotEmitFinished(t *testing.T) { | |||
| 149 | 151 | t.Fatalf("first load event = %+v, open %v; want sessionLoadStarted", event, ok) | |
| 150 | 152 | } | |
| 151 | 153 | d.ApplyLoad(event) | |
| 152 | - | case <-time.After(time.Second): | |
| 154 | + | case <-time.After(sessionDialogTestTimeout): | |
| 153 | 155 | t.Fatal("timed out waiting for sessionLoadStarted") | |
| 154 | 156 | } | |
| 155 | 157 | select { | |
| 156 | 158 | case <-entered: | |
| 157 | - | case <-time.After(time.Second): | |
| 159 | + | case <-time.After(sessionDialogTestTimeout): | |
| 158 | 160 | t.Fatal("timed out waiting for the session worker") | |
| 159 | 161 | } | |
| 160 | 162 | ||
| @@ -173,7 +175,7 @@ func TestSessionDialogCancellationDoesNotEmitFinished(t *testing.T) { | |||
| 173 | 175 | t.Fatal("canceled load emitted sessionLoadFinished") | |
| 174 | 176 | } | |
| 175 | 177 | d.ApplyLoad(event) | |
| 176 | - | case <-time.After(time.Second): | |
| 178 | + | case <-time.After(sessionDialogTestTimeout): | |
| 177 | 179 | t.Fatal("timed out waiting for canceled session load to close") | |
| 178 | 180 | } | |
| 179 | 181 | } | |
| @@ -221,12 +223,12 @@ func TestSessionDialogPreCanceledOpenPreservesPreviousLoadBarrier(t *testing.T) | |||
| 221 | 223 | t.Fatalf("first load event = %+v, open %v; want sessionLoadStarted", event, ok) | |
| 222 | 224 | } | |
| 223 | 225 | d.ApplyLoad(event) | |
| 224 | - | case <-time.After(time.Second): | |
| 226 | + | case <-time.After(sessionDialogTestTimeout): | |
| 225 | 227 | t.Fatal("timed out waiting for the first load to start") | |
| 226 | 228 | } | |
| 227 | 229 | select { | |
| 228 | 230 | case <-entered: | |
| 229 | - | case <-time.After(time.Second): | |
| 231 | + | case <-time.After(sessionDialogTestTimeout): | |
| 230 | 232 | t.Fatal("timed out waiting for the first worker") | |
| 231 | 233 | } | |
| 232 | 234 | ||
| @@ -253,7 +255,7 @@ func TestSessionDialogPreCanceledOpenPreservesPreviousLoadBarrier(t *testing.T) | |||
| 253 | 255 | t.Fatalf("third load event = %+v, open %v; want sessionLoadStarted after barrier", event, ok) | |
| 254 | 256 | } | |
| 255 | 257 | d.ApplyLoad(event) | |
| 256 | - | case <-time.After(time.Second): | |
| 258 | + | case <-time.After(sessionDialogTestTimeout): | |
| 257 | 259 | t.Fatal("timed out waiting for third load after releasing the first") | |
| 258 | 260 | } | |
| 259 | 261 | cancelThird() | |
| @@ -13,6 +13,8 @@ import ( | |||||
| 13 | "github.com/bnema/zut/packages/tui" | 13 | "github.com/bnema/zut/packages/tui" | ||
| 14 | ) | 14 | ) | ||
| 15 | 15 | ||||
| 16 | + | const sessionDialogTestTimeout = 10 * time.Second | |||
| 17 | + | ||||
| 16 | func TestFormatSessionRowPlainSanitizesControlBytes(t *testing.T) { | 18 | func TestFormatSessionRowPlainSanitizesControlBytes(t *testing.T) { | ||
| 17 | row := formatSessionRowPlain(core.SessionSummary{ | 19 | row := formatSessionRowPlain(core.SessionSummary{ | ||
| 18 | Provider: "test\x1b]0;bad\a", | 20 | Provider: "test\x1b]0;bad\a", | ||
| @@ -149,12 +151,12 @@ func TestSessionDialogCancellationDoesNotEmitFinished(t *testing.T) { | |||||
| 149 | t.Fatalf("first load event = %+v, open %v; want sessionLoadStarted", event, ok) | 151 | t.Fatalf("first load event = %+v, open %v; want sessionLoadStarted", event, ok) | ||
| 150 | } | 152 | } | ||
| 151 | d.ApplyLoad(event) | 153 | d.ApplyLoad(event) | ||
| 152 | - | case <-time.After(time.Second): | 154 | + | case <-time.After(sessionDialogTestTimeout): |
| 153 | t.Fatal("timed out waiting for sessionLoadStarted") | 155 | t.Fatal("timed out waiting for sessionLoadStarted") | ||
| 154 | } | 156 | } | ||
| 155 | select { | 157 | select { | ||
| 156 | case <-entered: | 158 | case <-entered: | ||
| 157 | - | case <-time.After(time.Second): | 159 | + | case <-time.After(sessionDialogTestTimeout): |
| 158 | t.Fatal("timed out waiting for the session worker") | 160 | t.Fatal("timed out waiting for the session worker") | ||
| 159 | } | 161 | } | ||
| 160 | 162 | ||||
| @@ -173,7 +175,7 @@ func TestSessionDialogCancellationDoesNotEmitFinished(t *testing.T) { | |||||
| 173 | t.Fatal("canceled load emitted sessionLoadFinished") | 175 | t.Fatal("canceled load emitted sessionLoadFinished") | ||
| 174 | } | 176 | } | ||
| 175 | d.ApplyLoad(event) | 177 | d.ApplyLoad(event) | ||
| 176 | - | case <-time.After(time.Second): | 178 | + | case <-time.After(sessionDialogTestTimeout): |
| 177 | t.Fatal("timed out waiting for canceled session load to close") | 179 | t.Fatal("timed out waiting for canceled session load to close") | ||
| 178 | } | 180 | } | ||
| 179 | } | 181 | } | ||
| @@ -221,12 +223,12 @@ func TestSessionDialogPreCanceledOpenPreservesPreviousLoadBarrier(t *testing.T) | |||||
| 221 | t.Fatalf("first load event = %+v, open %v; want sessionLoadStarted", event, ok) | 223 | t.Fatalf("first load event = %+v, open %v; want sessionLoadStarted", event, ok) | ||
| 222 | } | 224 | } | ||
| 223 | d.ApplyLoad(event) | 225 | d.ApplyLoad(event) | ||
| 224 | - | case <-time.After(time.Second): | 226 | + | case <-time.After(sessionDialogTestTimeout): |
| 225 | t.Fatal("timed out waiting for the first load to start") | 227 | t.Fatal("timed out waiting for the first load to start") | ||
| 226 | } | 228 | } | ||
| 227 | select { | 229 | select { | ||
| 228 | case <-entered: | 230 | case <-entered: | ||
| 229 | - | case <-time.After(time.Second): | 231 | + | case <-time.After(sessionDialogTestTimeout): |
| 230 | t.Fatal("timed out waiting for the first worker") | 232 | t.Fatal("timed out waiting for the first worker") | ||
| 231 | } | 233 | } | ||
| 232 | 234 | ||||
| @@ -253,7 +255,7 @@ func TestSessionDialogPreCanceledOpenPreservesPreviousLoadBarrier(t *testing.T) | |||||
| 253 | t.Fatalf("third load event = %+v, open %v; want sessionLoadStarted after barrier", event, ok) | 255 | t.Fatalf("third load event = %+v, open %v; want sessionLoadStarted after barrier", event, ok) | ||
| 254 | } | 256 | } | ||
| 255 | d.ApplyLoad(event) | 257 | d.ApplyLoad(event) | ||
| 256 | - | case <-time.After(time.Second): | 258 | + | case <-time.After(sessionDialogTestTimeout): |
| 257 | t.Fatal("timed out waiting for third load after releasing the first") | 259 | t.Fatal("timed out waiting for third load after releasing the first") | ||
| 258 | } | 260 | } | ||
| 259 | cancelThird() | 261 | cancelThird() | ||
M packages/agent/subagents/runner_e2e_test.go +10 -2
| @@ -66,12 +66,16 @@ func TestExecRunnerDeadlineGracefullyStopsWorkerAndPreservesStreamedOutput(t *te | |||
| 66 | 66 | t.Setenv("ZUT_STUB_BLOCK_INITIAL", "1") | |
| 67 | 67 | ||
| 68 | 68 | root := t.TempDir() | |
| 69 | + | inboxPath, err := inboxSocketPath(root, "deadline-test") | |
| 70 | + | if err != nil { | |
| 71 | + | t.Fatalf("inboxSocketPath: %v", err) | |
| 72 | + | } | |
| 69 | 73 | a := &Agent{ | |
| 70 | 74 | ID: "deadline-test", | |
| 71 | 75 | Task: "long-running task", | |
| 72 | 76 | Dir: root, | |
| 73 | 77 | SessionPath: filepath.Join(root, "session.jsonl"), | |
| 74 | - | InboxPath: filepath.Join(root, "inbox.sock"), | |
| 78 | + | InboxPath: inboxPath, | |
| 75 | 79 | EventLogPath: filepath.Join(root, "events.jsonl"), | |
| 76 | 80 | } | |
| 77 | 81 | a.inbox = NewInbox(a.InboxPath) | |
| @@ -145,12 +149,16 @@ func TestExecRunnerCancelsBlockedWorker(t *testing.T) { | |||
| 145 | 149 | t.Setenv("ZUT_STUB_BLOCK_INITIAL", "1") | |
| 146 | 150 | ||
| 147 | 151 | root := t.TempDir() | |
| 152 | + | inboxPath, err := inboxSocketPath(root, "cancel-test") | |
| 153 | + | if err != nil { | |
| 154 | + | t.Fatalf("inboxSocketPath: %v", err) | |
| 155 | + | } | |
| 148 | 156 | a := &Agent{ | |
| 149 | 157 | ID: "cancel-test", | |
| 150 | 158 | Task: "blocked task", | |
| 151 | 159 | Dir: root, | |
| 152 | 160 | SessionPath: filepath.Join(root, "session.jsonl"), | |
| 153 | - | InboxPath: filepath.Join(root, "inbox.sock"), | |
| 161 | + | InboxPath: inboxPath, | |
| 154 | 162 | EventLogPath: filepath.Join(root, "events.jsonl"), | |
| 155 | 163 | } | |
| 156 | 164 | a.inbox = NewInbox(a.InboxPath) | |
| @@ -66,12 +66,16 @@ func TestExecRunnerDeadlineGracefullyStopsWorkerAndPreservesStreamedOutput(t *te | |||||
| 66 | t.Setenv("ZUT_STUB_BLOCK_INITIAL", "1") | 66 | t.Setenv("ZUT_STUB_BLOCK_INITIAL", "1") | ||
| 67 | 67 | ||||
| 68 | root := t.TempDir() | 68 | root := t.TempDir() | ||
| 69 | + | inboxPath, err := inboxSocketPath(root, "deadline-test") | |||
| 70 | + | if err != nil { | |||
| 71 | + | t.Fatalf("inboxSocketPath: %v", err) | |||
| 72 | + | } | |||
| 69 | a := &Agent{ | 73 | a := &Agent{ | ||
| 70 | ID: "deadline-test", | 74 | ID: "deadline-test", | ||
| 71 | Task: "long-running task", | 75 | Task: "long-running task", | ||
| 72 | Dir: root, | 76 | Dir: root, | ||
| 73 | SessionPath: filepath.Join(root, "session.jsonl"), | 77 | SessionPath: filepath.Join(root, "session.jsonl"), | ||
| 74 | - | InboxPath: filepath.Join(root, "inbox.sock"), | 78 | + | InboxPath: inboxPath, |
| 75 | EventLogPath: filepath.Join(root, "events.jsonl"), | 79 | EventLogPath: filepath.Join(root, "events.jsonl"), | ||
| 76 | } | 80 | } | ||
| 77 | a.inbox = NewInbox(a.InboxPath) | 81 | a.inbox = NewInbox(a.InboxPath) | ||
| @@ -145,12 +149,16 @@ func TestExecRunnerCancelsBlockedWorker(t *testing.T) { | |||||
| 145 | t.Setenv("ZUT_STUB_BLOCK_INITIAL", "1") | 149 | t.Setenv("ZUT_STUB_BLOCK_INITIAL", "1") | ||
| 146 | 150 | ||||
| 147 | root := t.TempDir() | 151 | root := t.TempDir() | ||
| 152 | + | inboxPath, err := inboxSocketPath(root, "cancel-test") | |||
| 153 | + | if err != nil { | |||
| 154 | + | t.Fatalf("inboxSocketPath: %v", err) | |||
| 155 | + | } | |||
| 148 | a := &Agent{ | 156 | a := &Agent{ | ||
| 149 | ID: "cancel-test", | 157 | ID: "cancel-test", | ||
| 150 | Task: "blocked task", | 158 | Task: "blocked task", | ||
| 151 | Dir: root, | 159 | Dir: root, | ||
| 152 | SessionPath: filepath.Join(root, "session.jsonl"), | 160 | SessionPath: filepath.Join(root, "session.jsonl"), | ||
| 153 | - | InboxPath: filepath.Join(root, "inbox.sock"), | 161 | + | InboxPath: inboxPath, |
| 154 | EventLogPath: filepath.Join(root, "events.jsonl"), | 162 | EventLogPath: filepath.Join(root, "events.jsonl"), | ||
| 155 | } | 163 | } | ||
| 156 | a.inbox = NewInbox(a.InboxPath) | 164 | a.inbox = NewInbox(a.InboxPath) | ||