2fe634141f
gates / gates (push) Successful in 45s
R-1142: the HDD_PATH root is appdata/<own folder>, with a compiled-in folder map (paperless-ngx -> paperless). R-981: the allow-list is empty (homepage's socket served no Felhom feature). R-1063: finalizeDecommissionWith asks the agent before it marks the drive or moves the default; the 403/409 come back typed and reach the household as a plain 409. R-1069: the agent's no-durable-id format refusal is ErrNoDurableID and a plain sentence. R-1143: build.sh carries :latest only for x.y.z. Each pinned by a red-proofed test. MinAgent 0.158.1.
42 lines
1.7 KiB
Go
42 lines
1.7 KiB
Go
package web
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/agentapi"
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/util"
|
|
)
|
|
|
|
// R-1069: a disk the agent cannot bind a format to (a virtio disk without a serial) is refused with a plain
|
|
// sentence in the household's language — what happened, that nothing changed, who can fix it — and the init stops
|
|
// before any mount or registration. The agent's refusal itself is unchanged (a safety rule).
|
|
// RED-PROOF: with the ErrNoDurableID branch removed from runStorageInit, the error is „formázás sikertelen:
|
|
// agentapi: format refused — …" and the HU/EN assertions fail.
|
|
func TestR1069_NoDurableIDIsAPlainRefusal(t *testing.T) {
|
|
s := testServer(t)
|
|
agent := &mockAgent{formatErr: agentapi.ErrNoDurableID}
|
|
_, err := s.runStorageInit(context.Background(), agent, "/dev/vdb", "ext4", "/mnt/felhom-drives/adat", "Adat", false, false, "", nil)
|
|
if err == nil {
|
|
t.Fatal("the init went on although the agent refused the format")
|
|
}
|
|
if len(agent.assignCalls) != 0 {
|
|
t.Fatalf("a mount was attempted after the refusal: %v", agent.assignCalls)
|
|
}
|
|
hu, en := util.ErrText("hu", err), util.ErrText("en", err)
|
|
for _, frag := range []string{"virtu", "sorozatsz", "nem v", "zemeltet"} {
|
|
if !strings.Contains(hu, frag) {
|
|
t.Errorf("HU text lacks %q: %q", frag, hu)
|
|
}
|
|
}
|
|
for _, frag := range []string{"virtual machine", "serial number", "was not changed", "operator"} {
|
|
if !strings.Contains(en, frag) {
|
|
t.Errorf("EN text lacks %q: %q", frag, en)
|
|
}
|
|
}
|
|
if strings.Contains(hu, "agentapi") || strings.Contains(en, "agentapi") {
|
|
t.Errorf("the raw agent text reached the household: %q / %q", hu, en)
|
|
}
|
|
}
|