test: reproduce dropped speculative suffix with coverage format

This commit is contained in:
pingqiu committed 2026-11-30 19:04:51 -08:00
1 parent a5f213b62c
commit 94f1e5d083
1 file changed
+20
@@ -2,6 +2,7 @@ package storage
import (
"bytes"
"context"
"encoding/binary"
"errors"
"path/filepath"
@@ -459,7 +460,26 @@ func TestCheckpointV3_AppendRolloverFaultRefusesHeldCandidate(t *testing.T) {
// Max-LSN map entries may include unsynced writes above both cp and W. A
// reused LSN can then set UNKNOWN without changing the prefix proof token.
func TestCheckpointV3_SpeculativeMaximumAfterDroppedSuffix(t *testing.T) {
for _, coverage := range []bool{false, true} {
t.Run(map[bool]string{false: "format1", true: "coverage"}[coverage], func(t *testing.T) {
testSpeculativeMaximumAfterDroppedSuffix(t, coverage)
})
}
}
func testSpeculativeMaximumAfterDroppedSuffix(t *testing.T, coverage bool) {
s, path := newMappedCheckpointStoreV3(t)
if coverage {
s.HoldExtentDrainUntilChunkLayer()
if _, err := s.Recover(); err != nil {
t.Fatal(err)
}
if err := s.InitializeChunkCoverage(context.Background(), 1, func(uint64, uint64) (ChunkCoverageSeed, error) {
return ChunkCoverageSeed{All: true}, nil
}, coverageNoPages); err != nil {
t.Fatal(err)
}
}
remote := newFakeChunkRemote()
layer := mustAttach(t, s, remote, ctConfig(1))
if _, err := s.Write(1, blk(0xA1)); err != nil {