mesh-issues: take every condition key the controller raises, a delivery's with its slash among them (hq issue 475)
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate pass: builds mesh-issues → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
mesh/delivery superseded: a newer head of the same pull request
mesh/merge-gate pass: builds mesh-issues → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
The tracker's own pattern refused the slash a delivery's id carries, so no issue could track a delivery's condition and the operator's alert kept saying no issue tracks it. Mirror the controller's key rule instead of a pattern of our own; a router test proves a slashed key is matched and named end to end.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// A delivery's condition, whose key holds its repository as owner/name, is matched to the issue that tracks it and
|
||||
// its message names that issue (novox/hq issue 475). The key is the real one `mesh-controller.status` named; the
|
||||
// event is decoded as the controller says it, so the key travels as it does on the bus.
|
||||
func TestADeliverysConditionWithASlashInItsKeyNamesTheIssueThatTracksIt(t *testing.T) {
|
||||
const key = "delivery.novox/mesh-controller_d2e9dc61590f.stalled"
|
||||
h, tg, _, c, _ := newHolder(t)
|
||||
h.Ask = func(address string, body any) (json.RawMessage, error) {
|
||||
if address != TrackingVerb {
|
||||
return json.RawMessage(`{"ok":true}`), nil
|
||||
}
|
||||
return json.RawMessage(`{"conditions":{"` + key + `":[{"number":475,"status":"open"}]}}`), nil
|
||||
}
|
||||
k, err := DecodeCondition(EventRaised, []byte(`{"key":"`+key+`","kind":"stalled","severity":"urgent",`+
|
||||
`"subject":{"scope":"delivery","id":"novox/mesh-controller_d2e9dc61590f"},`+
|
||||
`"headline":"Delivery of mesh-controller stalled",`+
|
||||
`"explanation":"Needs you: let the walk go or drop it. The delivery of mesh-controller waits for a walk that never starts.",`+
|
||||
`"needs":"let the walk go or drop it.","summary":"the delivery of mesh-controller waits for its walk"}`))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if k.Key != key {
|
||||
t.Fatalf("the key was read as %q", k.Key)
|
||||
}
|
||||
k.Raised = c.now()
|
||||
h.Condition(EventRaised, k)
|
||||
settle(h, c)
|
||||
if len(tg.sends) != 1 {
|
||||
t.Fatalf("telegram %d", len(tg.sends))
|
||||
}
|
||||
body := tg.sends[0].Body
|
||||
if !strings.Contains(body, "Tracked as issue 475") || strings.Contains(body, "No issue tracks this yet.") {
|
||||
t.Fatalf("body: %q", body)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user