GT: an act the forge bridge ends not-needed is ended in its record
The forge bridge ends an act whose pull request closed unmerged with the outcome not-needed. The gate keeps it in the record's acts as ended, as it keeps performed and could not be performed, and no longer counts it as owed. The gate's code takes any outcome forgemsg reads, so the change is forgemsg's outcome list at mesh-delivery feat/47-H2-a. The row in the owed-acts test fails where forgemsg refuses not-needed. Builds: design 47 H2 §807; H-A-432 (2)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshdelivery"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-forge-bridge/forgemsg"
|
||||
)
|
||||
|
||||
type sayerFake struct{ said []seat.Owed }
|
||||
@@ -70,6 +71,34 @@ func TestARecordsChangesOweTheNoteTheViewAndWhenFailedOrHeldAComment(t *testing.
|
||||
t.Fatalf("said again: %v %d", err, len(f.said))
|
||||
}
|
||||
})
|
||||
// Design 47 H2 §807, H-A-432 (2): an act whose pull request closed unmerged ends not-needed, kept in the record's acts as
|
||||
// ended like performed and could not be performed, and no longer owed.
|
||||
t.Run("an act the forge bridge ends not-needed is ended in the record and owed no more", func(t *testing.T) {
|
||||
h, rs, r, f := setup(t)
|
||||
h.Logf = func(string, ...any) {}
|
||||
if _, err := rs.Outcome(r, RecordOutcome{Module: "mesh-x", Fingerprint: "src2:f1", Node: "ace", Step: "build", Outcome: OutcomeBuilt, Why: "built it"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
id := f.said[0].ID
|
||||
body, err := forgemsg.EncodeOwedEnded(forgemsg.OwedEnded{V: 1, Of: seat.Seat, ID: id, Outcome: forgemsg.OwedNotNeeded,
|
||||
Words: "novox/app#7 closed unmerged", At: at})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := h.OwedEnded(body); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
kept, err := rs.Kept()
|
||||
if err != nil || len(kept) != 1 {
|
||||
t.Fatalf("kept %d records: %v", len(kept), err)
|
||||
}
|
||||
if a := kept[0].Acts[id]; a.Outcome != forgemsg.OwedNotNeeded || a.Words != "novox/app#7 closed unmerged" {
|
||||
t.Fatalf("the act is kept as %+v", a)
|
||||
}
|
||||
if owed := h.Status("")["owed"]; owed != 1 {
|
||||
t.Fatalf("%v acts owed, not the one left", owed)
|
||||
}
|
||||
})
|
||||
t.Run("a record ended failed says a comment naming why; ended healthy says none", func(t *testing.T) {
|
||||
_, rs, r, f := setup(t)
|
||||
if _, err := rs.Outcome(r, RecordOutcome{Module: "mesh-x", Fingerprint: "src2:f1", Node: "ace", Step: "build", Outcome: OutcomeFailed, Why: "tests red"}); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user