package backup import ( "context" "strings" "testing" "time" "gitea.dooplex.hu/admin/felhom-agent/internal/reconcile" ) // R-672 (v0.133.0): a restore-test the SPACE preflight refused is the test's RESULT — recorded for the // hub as pass=false with the reason, never dropped (a band skip still is) and never a pass. // // COMPANION RED-PROOF (REPORT): the scheduler's pre-v0.133.0 `if res.Skipped { return }` → "a space // refusal never reached the host report". func TestR672_SpaceSkipIsReportedNotDropped(t *testing.T) { store := NewStore() rt := &fakeRTRunner{res: reconcile.RestoreTestResult{Archive: "vol", Skipped: true, SkipReason: "skipped: not enough space on local-lvm: restoring 21.1 GiB (vzdump log) needs 30.3 GiB free, has 21.6 GiB"}} s := NewScheduler(SchedulerOptions{ Runner: rt, Pick: func(context.Context) (string, error) { return "vol", nil }, Store: store, Spec: func(context.Context, string) reconcile.RestoreTestSpec { return reconcile.RestoreTestSpec{RestoreStorage: "local-lvm", ScratchMin: 990000, ScratchMax: 990009} }, Cadence: time.Hour, Logger: quiet(), }) s.tick(context.Background()) got := store.RestoreTests(context.Background()) if len(got) != 1 { t.Fatalf("a space refusal never reached the host report: %+v", got) } if got[0].Pass || !got[0].Skipped || !strings.HasPrefix(got[0].Error, "skipped: not enough space") { t.Fatalf("record = %+v — want pass=false, skipped, the reason as the error", got[0]) } }