Commit 903a5f7
committed
test(raft): rename
Round-2 review on commit 070d5e6 from claude bot:
- Issue A (gocritic builtinShadow): renamed local const `cap` to
`spoolCap` in TestSnapshotSpool_OverrideViaEnv. `cap` is a Go
built-in identifier and shadows trip golangci-lint's gocritic
rule.
- Issue B (refactor coverage gap): Bytes() switched from
io.ReadAll to make([]byte, s.size) + io.ReadFull at PR-round-1.
TestSnapshotSpool_DefaultCapAcceptsRealisticFSM exercised Write
at 1.5 GiB but never called Bytes() — a regression where the
pre-allocation drifts out of sync with the on-disk size would
not surface. Added a Bytes() call after the write loop with:
- len(got) == target (catches short reads / size drift)
- first/last byte == 0xAB (catches catastrophic corruption
without paying the memory cost of full byte-equality on a
1.5 GiB slice)
No semantic changes. The OOM concern from the Codex P1 reviewer
is acknowledged in the PR body and tracked as a follow-up
(streaming apply); the immediate-incident risk is bounded by
real FSM size (~1.35 GiB today), not by the new 16 GiB ceiling.
Test:
go test -race -count=1 -short ./internal/raftengine/etcd
-- 11.6s, all green.
go test -race -count=1 \
-run TestSnapshotSpool_DefaultCapAcceptsRealisticFSM \
./internal/raftengine/etcd
-- 3.0s, green (1.5 GiB Write + Bytes round-trip succeeds).cap + add Bytes() round-trip (PR #746 r2)1 parent 070d5e6 commit 903a5f7
1 file changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
48 | 61 | | |
49 | 62 | | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
53 | 66 | | |
54 | | - | |
55 | | - | |
| 67 | + | |
| 68 | + | |
56 | 69 | | |
57 | 70 | | |
58 | 71 | | |
59 | 72 | | |
60 | 73 | | |
61 | | - | |
| 74 | + | |
62 | 75 | | |
63 | 76 | | |
64 | | - | |
| 77 | + | |
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
| |||
0 commit comments