detached eca5562

test(daemon): use generated clock mocks for coordinator

commit
eca5562d4584b34a4c1de0956deb5042d47838e5
author
brice · · 2026-07-11 18:00 UTC
parent
de6d25b
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +7 -5
M internal/usecase/daemon/copymode_test.go +2 -2
@@ -389,8 +389,8 @@ func TestScrollbackEvictionFeedsCopyModeYank(t *testing.T) {
389389 // Rendering is coordinator-driven: advance a controllable clock through the
390390 // retained resize timer and its resulting coordinator wake rather than
391391 // relying on wall-clock debounce delivery.
392- clk := &signalClock{timers: make(chan *signalTimer, 16)}
393- d := newTestDaemon(t, newFactory(t, p), clk)
392+ clk := newCoordinatorMockClock(t, 16)
393+ d := newTestDaemon(t, newFactory(t, p), clk.clock)
394394 tr, sends, releaseConn := newConn(t, mustHello(ports.IntentNew, "work", domain.Size{Cols: 16, Rows: 5}))
395395 advanceRender := func() {
396396 for range 4096 {
@@ -389,8 +389,8 @@ func TestScrollbackEvictionFeedsCopyModeYank(t *testing.T) {
389 // Rendering is coordinator-driven: advance a controllable clock through the389 // Rendering is coordinator-driven: advance a controllable clock through the
390 // retained resize timer and its resulting coordinator wake rather than390 // retained resize timer and its resulting coordinator wake rather than
391 // relying on wall-clock debounce delivery.391 // relying on wall-clock debounce delivery.
392- clk := &signalClock{timers: make(chan *signalTimer, 16)}392+ clk := newCoordinatorMockClock(t, 16)
393- d := newTestDaemon(t, newFactory(t, p), clk)393+ d := newTestDaemon(t, newFactory(t, p), clk.clock)
394 tr, sends, releaseConn := newConn(t, mustHello(ports.IntentNew, "work", domain.Size{Cols: 16, Rows: 5}))394 tr, sends, releaseConn := newConn(t, mustHello(ports.IntentNew, "work", domain.Size{Cols: 16, Rows: 5}))
395 advanceRender := func() {395 advanceRender := func() {
396 for range 4096 {396 for range 4096 {
M internal/usecase/daemon/render_coordinator_test.go +3 -1
@@ -45,7 +45,9 @@ func newCoordinatorMockClock(t *testing.T, capacity int) *coordinatorMockClock {
4545 clk.clock.EXPECT().NewTimer(mock.MatchedBy(func(d time.Duration) bool {
4646 return d == urgentRenderDeadline ||
4747 (d >= minOutputRenderDeadline && d <= maxOutputRenderDeadline) ||
48- d == maxSyncUpdateDuration
48+ d == maxSyncUpdateDuration ||
49+ d == time.Second ||
50+ d == 15*time.Minute
4951 })).RunAndReturn(func(d time.Duration) ports.Timer {
5052 timer := &coordinatorMockTimer{
5153 mock: portsmocks.NewMockTimer(t),
@@ -45,7 +45,9 @@ func newCoordinatorMockClock(t *testing.T, capacity int) *coordinatorMockClock {
45 clk.clock.EXPECT().NewTimer(mock.MatchedBy(func(d time.Duration) bool {45 clk.clock.EXPECT().NewTimer(mock.MatchedBy(func(d time.Duration) bool {
46 return d == urgentRenderDeadline ||46 return d == urgentRenderDeadline ||
47 (d >= minOutputRenderDeadline && d <= maxOutputRenderDeadline) ||47 (d >= minOutputRenderDeadline && d <= maxOutputRenderDeadline) ||
48- d == maxSyncUpdateDuration48+ d == maxSyncUpdateDuration ||
49+ d == time.Second ||
50+ d == 15*time.Minute
49 })).RunAndReturn(func(d time.Duration) ports.Timer {51 })).RunAndReturn(func(d time.Duration) ports.Timer {
50 timer := &coordinatorMockTimer{52 timer := &coordinatorMockTimer{
51 mock: portsmocks.NewMockTimer(t),53 mock: portsmocks.NewMockTimer(t),
M internal/usecase/daemon/status_test.go +2 -2
@@ -1312,8 +1312,8 @@ func TestStatusBarCopyFeedbackBoundaryWidths(t *testing.T) {
13121312 func TestStatusCoalescesCreateSwitchAndResize(t *testing.T) {
13131313 p1, releasePTY1 := newBlockingPTY(t)
13141314 p2, releasePTY2 := newBlockingPTY(t)
1315- clock := &signalClock{timers: make(chan *signalTimer, 64)}
1316- d := newTestDaemon(t, newFactorySeq(t, p1, p2), clock)
1315+ clock := newCoordinatorMockClock(t, 64)
1316+ d := newTestDaemon(t, newFactorySeq(t, p1, p2), clock.clock)
13171317 tr, sends, releaseConn := newConn(t,
13181318 mustHello(ports.IntentNew, "work", domain.Size{Cols: 20, Rows: 5}),
13191319 frameInput([]byte("\x1b ")),
@@ -1312,8 +1312,8 @@ func TestStatusBarCopyFeedbackBoundaryWidths(t *testing.T) {
1312 func TestStatusCoalescesCreateSwitchAndResize(t *testing.T) {1312 func TestStatusCoalescesCreateSwitchAndResize(t *testing.T) {
1313 p1, releasePTY1 := newBlockingPTY(t)1313 p1, releasePTY1 := newBlockingPTY(t)
1314 p2, releasePTY2 := newBlockingPTY(t)1314 p2, releasePTY2 := newBlockingPTY(t)
1315- clock := &signalClock{timers: make(chan *signalTimer, 64)}1315+ clock := newCoordinatorMockClock(t, 64)
1316- d := newTestDaemon(t, newFactorySeq(t, p1, p2), clock)1316+ d := newTestDaemon(t, newFactorySeq(t, p1, p2), clock.clock)
1317 tr, sends, releaseConn := newConn(t,1317 tr, sends, releaseConn := newConn(t,
1318 mustHello(ports.IntentNew, "work", domain.Size{Cols: 20, Rows: 5}),1318 mustHello(ports.IntentNew, "work", domain.Size{Cols: 20, Rows: 5}),
1319 frameInput([]byte("\x1b ")),1319 frameInput([]byte("\x1b ")),

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close