package web import ( "strings" "testing" "gitea.dooplex.hu/admin/felhom-controller/internal/backup" ) // R-645 (09 ยง3 decision 142): an app the night backup leaves alone because it is not running its pinned // version says so on the backups page โ€” amber, in the reader's language โ€” and an app running its pin // keeps its ordinary row. // // Red-proof: delete the VersionSkipFor block in buildAppBackupRows โ€” the docmost row reads green and // this test fails. func TestR645_BackupRowSaysTheNightBackupSkipsIt(t *testing.T) { s, _, m := newOffboxWebServer(t) m.SetStackProvider(&blockProvider{hdd: t.TempDir()}) m.SetVersionCheck(func(name string) (string, bool) { return "x", name == "docmost" }) status := &backup.FullBackupStatus{AppDataInfo: []backup.AppBackupInfo{ {StackName: "docmost", DisplayName: "Docmost", HasVolumeData: true}, {StackName: "privatebin", DisplayName: "PrivateBin", HasVolumeData: true}, }} for lang, want := range map[string]string{"hu": "jszakai ment", "en": "night backup leaves it out"} { rows := s.buildAppBackupRows(status, lang) d := findRow(rows, "docmost") if d == nil || d.Status != "yellow" || !strings.Contains(d.StatusText, want) { t.Errorf("%s: docmost row = %+v, want amber with %q", lang, d, want) } if p := findRow(rows, "privatebin"); p == nil || p.Status != "green" { t.Errorf("%s: positive control: privatebin must stay green, got %+v", lang, p) } } }