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"]) } }