206b0357d1
gates / gates (push) Successful in 27s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package web
|
|
|
|
import (
|
|
"regexp"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
|
|
)
|
|
|
|
// R-659 (v0.268.0) — a hold that names NO whole copy gets no restore button beside its sentence, on
|
|
// either page; a hold that names one keeps it. A render test PER BRANCH of the gate (seam-wiring rule).
|
|
//
|
|
// COMPANION RED-PROOF (REPORT.md): drop `{{if not .HoldNoWholeCopy}}` from stacks.html — the
|
|
// "no whole copy" branch fails with the button present.
|
|
|
|
var heldButton = regexp.MustCompile(`data-held="true">[^<]*<a href="/backups/apps"`)
|
|
|
|
func TestR659_HeldPage_NoWholeCopyOffersNoRestoreButton(t *testing.T) {
|
|
for _, noWhole := range []bool{true, false} {
|
|
st := ubStack(nil, map[string]string{"web": "nginx:1.27"}, "2026-07-18")
|
|
st.State = stacks.StateStopped
|
|
st.HoldReason = "HOLD SENTENCE"
|
|
st.HoldNoWholeCopy = noWhole
|
|
for _, page := range []string{"stacks", "app_info"} {
|
|
var h string
|
|
if page == "stacks" {
|
|
h = renderBackupPage(t, "stacks", ubStacksData(st))
|
|
} else {
|
|
h = renderBackupPage(t, "app_info", appInfoData(st))
|
|
}
|
|
got := heldButton.MatchString(h)
|
|
if noWhole && got {
|
|
t.Errorf("%s: a hold naming no whole copy still offers the Mentések button — the restore there would refuse", page)
|
|
}
|
|
if !noWhole && !got {
|
|
t.Errorf("%s: positive control — a hold naming a whole copy must keep its way back", page)
|
|
}
|
|
}
|
|
}
|
|
}
|