Commit 2a31327
committed
test(kv): add FSM-level threading tests for SetApplyIndex → applier raftIdx
Closes the unit-test coverage gap claude's PR784 round-2 review
identified: the applier-level regression tests
(TestApplyBootstrap_PersistsRaftAppliedIndex) call ApplyBootstrap
directly, bypassing the FSM. Without this commit, a future
refactor that accidentally drops `f.pendingApplyIdx` from
`applyEncryption`'s argument list (or reorders the
SetApplyIndex / Apply sequence at the engine boundary) would
not be caught at unit-test level — the full chain would still
compile but the index would be silently truncated to zero.
Two new tests pin the chain:
- TestApply_Bootstrap_ThreadsRaftIdx — SetApplyIndex(184273) +
Apply(0x04) → assert applier.lastBootstrapIdx == 184273
- TestApply_Rotation_ThreadsRaftIdx — same for the 0x05
rotation path
Both use the existing fakeApplier (whose lastBootstrapIdx /
lastRotationIdx fields were added in commit 487e21d) so no
production code changed.
go test -race ./kv/ — PASS
golangci-lint run ./kv/ — 0 issues1 parent 487e21d commit 2a31327
1 file changed
Lines changed: 68 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
128 | 196 | | |
129 | 197 | | |
130 | 198 | | |
| |||
0 commit comments