| index dad6e8472..0f9a38a78 100644 |
| --- a/internal/console/apiinstances_test.go |
| +++ b/internal/console/apiinstances_test.go |
| @@ -1460,7 +1460,8 @@ func TestAPIInstanceUpdateAuditNamesChangedFields(t *testing.T) { |
| |
| // Multi-field case: a patch touching addrs AND steering together names |
| // both, in the order the request struct declares them (addrs, probe, |
| - // steering, gate) — not just one of the two, and not a generic "updated". |
| + // steering, environment, gate) — not just one of the two, and not a |
| + // generic "updated". |
| if status, _, out := rawReq(t, http.MethodPatch, pu, token, |
| `{"addrs":["127.0.0.1:7002"],"steering":""}`); status != http.StatusOK { |
| t.Fatalf("patch addrs+steering = %d %s, want 200", status, out) |
| @@ -1468,6 +1469,25 @@ func TestAPIInstanceUpdateAuditNamesChangedFields(t *testing.T) { |
| if detail := lastEventDetail(t, fx, "titogo"); detail != "updated instance audit.go.tito.io (addrs, steering) (cli)" { |
| t.Fatalf("audit detail = %q, want it to name both addrs and steering", detail) |
| } |
| + |
| + // environment-only case: an environment patch names ONLY environment — |
| + // the mutation applies req.Environment, so the audit line must too. |
| + if status, _, out := rawReq(t, http.MethodPatch, pu, token, `{"environment":"demo"}`); status != http.StatusOK { |
| + t.Fatalf("patch environment = %d %s, want 200", status, out) |
| + } |
| + if detail := lastEventDetail(t, fx, "titogo"); detail != "updated instance audit.go.tito.io (environment) (cli)" { |
| + t.Fatalf("audit detail = %q, want it to name exactly environment", detail) |
| + } |
| + |
| + // Combined case: steering, environment and gate together name all |
| + // three, in request-struct order. |
| + if status, _, out := rawReq(t, http.MethodPatch, pu, token, |
| + `{"steering":"","environment":"","gate":""}`); status != http.StatusOK { |
| + t.Fatalf("patch steering+environment+gate = %d %s, want 200", status, out) |
| + } |
| + if detail := lastEventDetail(t, fx, "titogo"); detail != "updated instance audit.go.tito.io (steering, environment, gate) (cli)" { |
| + t.Fatalf("audit detail = %q, want it to name steering, environment and gate", detail) |
| + } |
| } |
| |
| // TestAPIInstanceUpdateSteeringInvalidValue: the door's own vocabulary rail |