24 lines
867 B
Go
24 lines
867 B
Go
package backup
|
|
|
|
// THROWAWAY proof for the 2026-10-20 data-loss hunt (R-1188 c). Never committed. A crash during the whole restore's
|
|
// file copy leaves `<file>.felhom-restoring` behind (the copy writes it with O_EXCL); the retry then meets it.
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestRehearsalR12_LeftoverTempBlocksEveryRetry(t *testing.T) {
|
|
f, _, liveLeg := wholeFixture(t)
|
|
// what a power cut in the middle of copying p1.jpg leaves on the live drive
|
|
if err := os.MkdirAll(liveLeg, 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
os.WriteFile(filepath.Join(liveLeg, "p1.jpg.felhom-restoring"), []byte("half"), 0o644)
|
|
for i := 1; i <= 2; i++ {
|
|
_, err := f.m.RestoreTier2Whole("app")
|
|
_, statErr := os.Stat(filepath.Join(liveLeg, "p1.jpg"))
|
|
t.Logf("retry %d: err=%v; p1.jpg back=%v; app restarted=%v", i, err, statErr == nil, f.fake.fullStarted)
|
|
}
|
|
}
|