test(daemon): use generated clock mocks for coordinator
- commit
- eca5562d4584b34a4c1de0956deb5042d47838e5
- author
- brice · · 2026-07-11 18:00 UTC
- parent
- de6d25b
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· 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) { | |||
| 389 | 389 | // Rendering is coordinator-driven: advance a controllable clock through the | |
| 390 | 390 | // retained resize timer and its resulting coordinator wake rather than | |
| 391 | 391 | // 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) | |
| 394 | 394 | tr, sends, releaseConn := newConn(t, mustHello(ports.IntentNew, "work", domain.Size{Cols: 16, Rows: 5})) | |
| 395 | 395 | advanceRender := func() { | |
| 396 | 396 | for range 4096 { | |
| @@ -389,8 +389,8 @@ func TestScrollbackEvictionFeedsCopyModeYank(t *testing.T) { | |||||
| 389 | // Rendering is coordinator-driven: advance a controllable clock through the | 389 | // Rendering is coordinator-driven: advance a controllable clock through the | ||
| 390 | // retained resize timer and its resulting coordinator wake rather than | 390 | // 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 { | |||
| 45 | 45 | clk.clock.EXPECT().NewTimer(mock.MatchedBy(func(d time.Duration) bool { | |
| 46 | 46 | return d == urgentRenderDeadline || | |
| 47 | 47 | (d >= minOutputRenderDeadline && d <= maxOutputRenderDeadline) || | |
| 48 | - | d == maxSyncUpdateDuration | |
| 48 | + | d == maxSyncUpdateDuration || | |
| 49 | + | d == time.Second || | |
| 50 | + | d == 15*time.Minute | |
| 49 | 51 | })).RunAndReturn(func(d time.Duration) ports.Timer { | |
| 50 | 52 | timer := &coordinatorMockTimer{ | |
| 51 | 53 | 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 == maxSyncUpdateDuration | 48 | + | 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) { | |||
| 1312 | 1312 | func TestStatusCoalescesCreateSwitchAndResize(t *testing.T) { | |
| 1313 | 1313 | p1, releasePTY1 := newBlockingPTY(t) | |
| 1314 | 1314 | 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) | |
| 1317 | 1317 | tr, sends, releaseConn := newConn(t, | |
| 1318 | 1318 | mustHello(ports.IntentNew, "work", domain.Size{Cols: 20, Rows: 5}), | |
| 1319 | 1319 | 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 ")), | ||