3c6b49b31c
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
36 lines
1.5 KiB
Go
36 lines
1.5 KiB
Go
package web
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
|
|
)
|
|
|
|
// Decision 28 on the page: an unhealthy stop offers START (its way back) and no Mentések; the badge
|
|
// does not say "restore needed". Render test per branch.
|
|
func TestD28_UnhealthyStopPageOffersStart(t *testing.T) {
|
|
st := ubStack(nil, map[string]string{"web": "nginx:1.27"}, "2026-07-18")
|
|
st.Name = "bookstack"
|
|
st.State = stacks.StateStopped
|
|
st.HoldReason = "STOPPED BY THE BOX"
|
|
st.HoldKind = "unhealthy_stop"
|
|
h := renderBackupPage(t, "stacks", ubStacksData(st))
|
|
if !strings.Contains(h, `data-unhealthy-stop="true"`) || !strings.Contains(h, `stackAction(event, 'bookstack', 'start')`) {
|
|
t.Fatal("the unhealthy stop must show its sentence and a Start button")
|
|
}
|
|
if strings.Contains(h, `data-held="true"`) || strings.Contains(h, "visszaállítás szükséges") {
|
|
t.Fatal("an unhealthy stop is not a restore case")
|
|
}
|
|
a := renderBackupPage(t, "app_info", appInfoData(st))
|
|
if !strings.Contains(a, `data-unhealthy-stop="true"`) || strings.Contains(a, `data-held="true"`) {
|
|
t.Fatal("app page: wrong branch for an unhealthy stop")
|
|
}
|
|
// positive control: an UPDATE hold keeps the restore branch
|
|
st.HoldKind = "update_failed"
|
|
h2 := renderBackupPage(t, "stacks", ubStacksData(st))
|
|
if !strings.Contains(h2, `data-held="true"`) || strings.Contains(h2, `stackAction(event, 'bookstack', 'start')`) {
|
|
t.Fatal("an update hold must keep its restore branch and offer no Start")
|
|
}
|
|
}
|