Files
felhom.eu/hub/internal/api/r1398_extra_args_test.go
T
admin 1187900186
gates / gates (push) Successful in 2m3s
hub (unreleased): the operator's bind form has a field for extra installer flags — only plain --flag words pass (R-1398, release 4 Part 0)
The bind handler always read extra_args and the pairing answer always carried it; the Hosts page had no input, so
--accept-small-disk could not reach a public-image install. One text input, a validator in the store
(CleanApplianceExtraArgs), a 400 for a refused value. Tests TestR1398_* (4), 5 mutations red.

Register: R-1035's 4-week read moved to 2026-11-26 (the operator's Search Console read; reason in the row).

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-11-19 08:41:29 +01:00

34 lines
1.1 KiB
Go

package api
import (
"encoding/json"
"testing"
"gitea.dooplex.hu/admin/felhom-hub/internal/store"
)
// R-1398: the flag the operator puts in the bind form reaches the box in the pairing answer, word for word —
// the first-boot unit appends exactly this text to the installer's command line (felhom-bootstrap.sh, read -ra).
func TestR1398_ExtraArgsReachThePairingAnswer(t *testing.T) {
h, st, _ := newTestHandler(t)
if err := st.SaveCustomerConfig(&store.CustomerConfig{CustomerID: "acme", APIKey: "k", RetrievalPassword: "pw"}); err != nil {
t.Fatal(err)
}
token := registerAppliance(t, h, "uuid-X", []string{"bc:24:11:98:10:0e"})
list, _ := st.ListUnclaimedAppliances()
if err := st.BindAppliance(list[0].ID, "acme", "appliance", " --accept-small-disk "); err != nil {
t.Fatal(err)
}
rr := poll(t, h, token)
if rr.Code != 200 {
t.Fatalf("bound poll = %d", rr.Code)
}
var creds map[string]string
if err := json.Unmarshal(rr.Body.Bytes(), &creds); err != nil {
t.Fatal(err)
}
if creds["extra_args"] != "--accept-small-disk" {
t.Fatalf("extra_args in the pairing answer = %q, want --accept-small-disk", creds["extra_args"])
}
}