Unreleased: host_busy on GET /backup/status (R-921), a missing tunnel container is 'absent' and not-applicable after an OS update (R-1070), the janitor forces a half-removed vzdump snapshot once (R-1010)
gates / gates (push) Successful in 58s
gates / gates (push) Successful in 58s
This commit is contained in:
1 parent
0cbd500154
commit
56aabc729c
13 files changed
+323
-10
No files matched your search
@@ -13,6 +13,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/backup"
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/hub"
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/proxmox"
|
||||
)
|
||||
@@ -514,3 +515,47 @@ func TestBackupStatus_FiltersToThisGuest(t *testing.T) {
|
||||
t.Fatalf("status not scoped to this guest / not latest: %s", w.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
// R-921: GET /backup/status says when the host-wide heavy-operation gate is held, so the controller can skip the app
|
||||
// stop for a tier the POST would refuse. Free → busy false; held → busy true with the holder's name; the gate not wired
|
||||
// → no field at all (the controller's „older agent" reading, never „free").
|
||||
//
|
||||
// COMPANION RED-PROOF (observed 2026-10-19): with the `resp.HostBusy = …` assignment removed, the held case fails with
|
||||
//
|
||||
// server_test.go: free gate: host_busy = <nil>, want busy=false
|
||||
//
|
||||
// Restored.
|
||||
func TestBackupStatus_R921_HostBusy(t *testing.T) {
|
||||
read := func(h http.Handler) *HostBusyState {
|
||||
w := do(t, h, "GET", "/backup/status", "A", "")
|
||||
var resp struct {
|
||||
Data BackupStatusResponse `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("status body: %v (%s)", err, w.Body.String())
|
||||
}
|
||||
return resp.Data.HostBusy
|
||||
}
|
||||
srv := newTestServerS(t, &fakeGuests{}, &fakeBackups{}, &fakeStore{}, nil)
|
||||
if got := read(srv.Handler()); got != nil {
|
||||
t.Fatalf("gate not wired: host_busy = %+v, want absent", got)
|
||||
}
|
||||
gate := &backup.InFlight{}
|
||||
srv.inFlight = gate
|
||||
h := srv.Handler()
|
||||
if got := read(h); got == nil || got.Busy || got.What != "" {
|
||||
t.Fatalf("free gate: host_busy = %+v, want busy=false", got)
|
||||
}
|
||||
release, _, ok := gate.TryAcquire("os-pve-step")
|
||||
if !ok {
|
||||
t.Fatal("could not take the gate")
|
||||
}
|
||||
if got := read(h); got == nil || !got.Busy || got.What != "os-pve-step" {
|
||||
t.Fatalf("held gate: host_busy = %+v, want busy=true what=\"os-pve-step\"", got)
|
||||
}
|
||||
// The read never takes the gate: a POST after the holder lets go is accepted.
|
||||
release()
|
||||
if got := read(h); got == nil || got.Busy {
|
||||
t.Fatalf("released gate: host_busy = %+v, want busy=false", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user