v0.3.0 99dc266

ack_queue_test.go RawHistoryFolder

1package client
2
3import (
4	"context"
5	"io"
6	"log/slog"
7	"testing"
8
9	"github.com/bnema/vev/internal/ports"
10	"github.com/stretchr/testify/require"
11)
12
13type ackRecordingTransport struct{ sent chan ports.Frame }
14
15func (t *ackRecordingTransport) Send(f ports.Frame) error   { t.sent <- f; return nil }
16func (t *ackRecordingTransport) Recv() (ports.Frame, error) { return ports.Frame{}, io.EOF }
17func (t *ackRecordingTransport) Close() error               { return nil }
18
19func TestCumulativeAckBypassesFullNormalSendQueue(t *testing.T) {
20	normal := make(chan ports.Frame, sendQueueDepth)
21	for range cap(normal) {
22		normal <- ports.Frame{Type: ports.MsgInput}
23	}
24	const epoch = 7
25	acks := newCumulativeAckQueue()
26	for state := uint64(1); state <= maxUnackedOutputStatesForTest; state++ {
27		acks.offer(epoch, state)
28	}
29
30	ctx, cancel := context.WithCancel(context.Background())
31	defer cancel()
32	tr := &ackRecordingTransport{sent: make(chan ports.Frame, sendQueueDepth+1)}
33	errCh := make(chan error, 1)
34	go runSender(ctx, cancel, tr, normal, acks, errCh, slog.Default())
35
36	first := <-tr.sent
37	require.Equal(t, ports.MsgAck, first.Type)
38	ack, err := ports.UnmarshalAck(first.Payload)
39	require.NoError(t, err)
40	require.Equal(t, uint64(epoch), ack.Epoch)
41	require.Equal(t, uint64(maxUnackedOutputStatesForTest), ack.State)
42}
43
44const maxUnackedOutputStatesForTest = 8

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