28 lines
879 B
Go
28 lines
879 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// The stray-copy fix: main.go removes every leftover second-drive copy container BEFORE the scheduler and the web
|
|
// server start (either could begin a backup or a restore beside a lost copy). RED-PROOF (2026-10-22 night): the call
|
|
// removed, or moved below sched.Start, → this fails.
|
|
func TestStrayCopy_ClearIsWiredBeforeTheScheduler(t *testing.T) {
|
|
src, err := os.ReadFile("main.go")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
s := string(src)
|
|
c := strings.Index(s, "backup.ClearLeftoverTier2Copies(ctx)")
|
|
st := strings.Index(s, "sched.Start(ctx)")
|
|
ws := strings.Index(s, "web.NewServer(")
|
|
if c < 0 || st < 0 || ws < 0 {
|
|
t.Fatalf("missing: clear=%d sched.Start=%d web.NewServer=%d", c, st, ws)
|
|
}
|
|
if c > st || c > ws {
|
|
t.Fatal("the leftover-copy removal must run before the scheduler and the web server start")
|
|
}
|
|
}
|