Files
felhom-controller/controller/internal/backup/r240_zero_selection_test.go
T
admin 9e5b88146e
gates / gates (push) Successful in 1m14s
v0.306.0: R-570 — the off-site note decides on its kind only; the pre-0.251.0 text fallback is deleted
Fleet condition read on each box's settings.json 2026-10-10 (offbox.last_success ~02:16Z on 0.304.0).
Red-proof: the new no-kind row of TestR553_StaleNoteDecisionSurvivesWordingChange failed against the fallback.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-10-10 15:08:42 +02:00

39 lines
1.6 KiB
Go

package backup
import (
"context"
"strings"
"testing"
)
// R-240: an off-site run with no app selected reported „Sikeres — nincs mentésre jelölt alkalmazás":
// SUCCESSFUL right beside NOTHING SELECTED, the same shape as R-203/R-234 (a warning beside a success
// is read as a success). The consequence asserted through the real run: the verdict stays `ok` (an
// empty selection is not a failure), the note says plainly that the run saved nothing, it does NOT
// say „Sikeres", and it records its KIND (the page decides on the kind; R-570 removed the text fallback).
func TestR240_ZeroSelectionRunDoesNotSaySuccess(t *testing.T) {
m, sett := newOffboxManager(t)
m.SetOffboxRunner(func(_ context.Context, _ []string, args ...string) ([]byte, error) {
if contains(args, "cat") && contains(args, "config") {
return []byte(`{"version":2}`), nil
}
return []byte(`[]`), nil
})
if err := m.RunOffboxBackup(context.Background()); err != nil {
t.Fatalf("zero-selection run must not error: %v", err)
}
st := sett.GetOffboxTarget()
if st.LastStatus != "ok" {
t.Errorf("verdict = %q, want ok — an empty selection is not a failure", st.LastStatus)
}
if strings.Contains(st.LastWarning, "Sikeres") {
t.Errorf("R-240: the note for a run that saved nothing still calls itself successful: %q", st.LastWarning)
}
if !strings.Contains(st.LastWarning, "semmit nem mentett") {
t.Errorf("R-240: the note does not say the run saved nothing: %q", st.LastWarning)
}
if st.LastWarningKind != OffboxWarnNoAppsSelected {
t.Errorf("the kind is not recorded: %q", st.LastWarningKind)
}
}