From 5cf01ed1ba63f386563defc39fdf5d5cb03b0443 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 18:19:33 -0800 Subject: [PATCH] test: delete the five WAL test files that hold no test Single-volume coverage side finding (c) (V1-SPEC r2.55): walstore_sticky_fsync_test.go, walstore_midhistory_hole_test.go, walstore_checkpoint_crash_linux_test.go and walstore_checkpoint_safety_test.go held only helpers or constants with no caller (their tests were retired with format v2; docs/design/format-v3-legacy-test-inventory.md lists them and their v3 replacements). walstore_recovery_hardening_test.go keeps its one used helper, crashRecoveryHardeningStore. A comment that pointed at a deleted file is removed. Co-Authored-By: Claude Opus 5.5 --- .../durable_startup_slotcrc_test.go | 1 - .../walstore_checkpoint_crash_linux_test.go | 8 --- .../walstore_checkpoint_safety_test.go | 11 ---- .../storage/walstore_midhistory_hole_test.go | 22 -------- .../walstore_recovery_hardening_test.go | 53 ++----------------- .../storage/walstore_sticky_fsync_test.go | 26 --------- 6 files changed, 4 insertions(+), 117 deletions(-) delete mode 100644 seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go delete mode 100644 seaweed-block/core/storage/walstore_checkpoint_safety_test.go delete mode 100644 seaweed-block/core/storage/walstore_midhistory_hole_test.go delete mode 100644 seaweed-block/core/storage/walstore_sticky_fsync_test.go diff --git a/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go b/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go index bf0e7a71f7..7cb6b9097c 100644 --- a/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go +++ b/seaweed-block/cmd/blockvolume/durable_startup_slotcrc_test.go @@ -152,7 +152,6 @@ func TestDurableStartup_Issue51_SmartWALTornTailRecovers(t *testing.T) { // V3 replaces the legacy warning-only recovery policy with nonce-bound, // contiguous WAL recovery. Corruption below strict W must block readiness. -// The old v2 warning control is retained in walstore_midhistory_hole_test.go. func TestDurableStartup_Issue51_WALStoreV3CommittedHoleBlocksReadiness(t *testing.T) { const childEnv = "SWBLOCK_V3_STARTUP_CRASH_PATH" if path := os.Getenv(childEnv); path != "" { diff --git a/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go b/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go deleted file mode 100644 index 9d43987575..0000000000 --- a/seaweed-block/core/storage/walstore_checkpoint_crash_linux_test.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build linux - -package storage - -const ( - checkpointCrashHelperEnv = "SW_BLOCK_CHECKPOINT_CRASH_HELPER" - checkpointCrashPathEnv = "SW_BLOCK_CHECKPOINT_CRASH_PATH" -) diff --git a/seaweed-block/core/storage/walstore_checkpoint_safety_test.go b/seaweed-block/core/storage/walstore_checkpoint_safety_test.go deleted file mode 100644 index ea5b3cec51..0000000000 --- a/seaweed-block/core/storage/walstore_checkpoint_safety_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package storage - -import ( - "time" -) - -func replaceFlusherForTest(s *WALStore, interval time.Duration) { - s.flusher.Stop() - s.flusher = newFlusher(s, flusherConfig{Interval: interval}) - go s.flusher.run() -} diff --git a/seaweed-block/core/storage/walstore_midhistory_hole_test.go b/seaweed-block/core/storage/walstore_midhistory_hole_test.go deleted file mode 100644 index 50e7e2a2a1..0000000000 --- a/seaweed-block/core/storage/walstore_midhistory_hole_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package storage - -import ( - "strings" -) - -func walOffsetsByLBA(s *WALStore) map[uint64]uint64 { - offs := map[uint64]uint64{} - for _, e := range s.dm.snapshot() { - offs[e.LBA] = e.WALOffset - } - return offs -} - -func holeWarning(s *WALStore) bool { - for _, w := range s.RecoveryWarnings() { - if strings.HasPrefix(w, WarningWALHoleSuspected+":") { - return true - } - } - return false -} diff --git a/seaweed-block/core/storage/walstore_recovery_hardening_test.go b/seaweed-block/core/storage/walstore_recovery_hardening_test.go index 7428036e42..f5ae541ed1 100644 --- a/seaweed-block/core/storage/walstore_recovery_hardening_test.go +++ b/seaweed-block/core/storage/walstore_recovery_hardening_test.go @@ -1,14 +1,10 @@ package storage -import ( - "bytes" - "encoding/binary" - - "hash/crc32" - - "testing" -) +import "testing" +// crashRecoveryHardeningStore drops the store without a clean close: the +// committer stops, the owned map and the file descriptor close, nothing is +// flushed. Tests reopen the file afterwards to observe crash recovery. func crashRecoveryHardeningStore(t *testing.T, s *WALStore) { t.Helper() s.committer.Stop() @@ -22,44 +18,3 @@ func crashRecoveryHardeningStore(t *testing.T, s *WALStore) { t.Fatal(err) } } - -func recoverySnapshotEntriesByLBA(entries []snapshotEntry) map[uint64]snapshotEntry { - result := make(map[uint64]snapshotEntry, len(entries)) - for _, entry := range entries { - result[entry.LBA] = entry - } - return result -} - -func rewriteRecoveryRecordForTest( - t *testing.T, - s *WALStore, - recordSize uint64, - absoluteOffset int64, - mutate func([]byte), -) { - t.Helper() - record := make([]byte, recordSize) - if _, err := s.fd.ReadAt(record, absoluteOffset); err != nil { - t.Fatal(err) - } - mutate(record) - binary.LittleEndian.PutUint32( - record[len(record)-8:], - crc32.ChecksumIEEE(record[:len(record)-8]), - ) - if _, err := s.fd.WriteAt(record, absoluteOffset); err != nil { - t.Fatal(err) - } -} - -func assertRecoveryHardeningBlock(t *testing.T, s *WALStore, lba uint32, want []byte) { - t.Helper() - got, err := s.Read(lba) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(got, want) { - t.Fatalf("current LBA %d mismatch", lba) - } -} diff --git a/seaweed-block/core/storage/walstore_sticky_fsync_test.go b/seaweed-block/core/storage/walstore_sticky_fsync_test.go deleted file mode 100644 index 344c4e0944..0000000000 --- a/seaweed-block/core/storage/walstore_sticky_fsync_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package storage - -import ( - "errors" - - "testing" -) - -// A failed fsync is sticky for the open store (the "fsyncgate" pattern: on -// Linux the kernel may already have dropped the dirty pages, so a later -// successful fsync proves nothing about them). After the first failure the -// store acknowledges no further Sync, accepts no further write and advances -// no checkpoint, with a typed SubstrateIO failure; only a reopen clears it. - -var errInjectedFsync = errors.New("injected fsync failure") - -func assertStickyFsync(t *testing.T, err error) { - t.Helper() - if !errors.Is(err, ErrFsyncFailed) { - t.Fatalf("err %v; want the sticky ErrFsyncFailed", err) - } - var rf *RecoveryFailure - if !errors.As(err, &rf) || rf.Kind != StorageRecoveryFailureSubstrateIO { - t.Fatalf("err %v; want a SubstrateIO RecoveryFailure (io_error)", err) - } -}