Files
felhom-controller/controller/internal/api/unknown_stack_action_test.go
T
admin 20c5877056
gates / gates (push) Successful in 27s
An action on a name that is no app answers 404, not 'settings cannot be saved' (found walking capability map B2 on 9202)
Test TestAnActionOnANameThatIsNoAppIsA404 red first. Commit only.
2026-10-28 23:56:36 +01:00

30 lines
1.2 KiB
Go

package api
import (
"encoding/json"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
// Found walking the capability map's B2 („App lifecycle") on 9202, 2026-10-28 night: a Stop of a name that is no app
// on this box (`felhom-controller` — bootstrap-managed, not a stack) answered 500 „…az alkalmazás beállításai nem
// menthetők." — the desired-state write's „not found" read as a save failure. It is a 404 now, before any intent is
// recorded. RED-PROOF: drop the ErrStackNotFound branch in actionStack → 500 → FAILS.
func TestAnActionOnANameThatIsNoAppIsA404(t *testing.T) {
r, _, _, _ := newSlice4Router(t)
for _, action := range []string{"stop", "start"} {
w := httptest.NewRecorder()
r.actionStack(w, httptest.NewRequest("POST", "/api/stacks/nosuchapp/"+action, nil), action, "nosuchapp")
var resp apiResponse
_ = json.Unmarshal(w.Body.Bytes(), &resp)
if w.Code != http.StatusNotFound {
t.Fatalf("%s of a name that is no app: %d %q — want 404", action, w.Code, resp.Error)
}
if strings.Contains(strings.ToLower(resp.Error), "mentheto") || strings.Contains(resp.Error, "menthetők") {
t.Fatalf("%s: the answer still blames a save: %q", action, resp.Error)
}
}
}