GATE2: the whole-module test counts the merges handed in the state merges, the merge as an owed act being left out of the join
Builds: design 47 G §160, tests 34, 39 (eb131beb left out, G §167, §542) Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -697,7 +698,7 @@ func TestAPassingVerdictAsksTheApproveAndItsApproveMergesWithinSecondsOverARealB
|
||||
var d Delivery
|
||||
return err == nil && json.Unmarshal(e.Value(), &d) == nil && d.State == Merged
|
||||
})
|
||||
if n := len(rt2.mergesSaid()); n != 0 || len(onlyAskKeys(b)) > 1 {
|
||||
if n := len(rt2.mergesSaid()); n != merges || len(onlyAskKeys(b)) > 1 {
|
||||
t.Fatalf("the restarted gate said the merge %d more times (%d before), or asked again: %v", n, merges, onlyAskKeys(b))
|
||||
}
|
||||
// Quiet follows: nothing asks the forge or the controller again with no event to say so.
|
||||
@@ -908,3 +909,25 @@ func mustDecode[T any](t *testing.T, raw []byte) T {
|
||||
// (issue 1404). A failed first ask is asked again only after askAgainAfter (30 s, react.go), and 20 s deliberately does not
|
||||
// cover that: a failed first ask still fails the test.
|
||||
const eventWithin = 20 * time.Second
|
||||
|
||||
// mergesSaid are the writes of the gate's state merges, the merges it handed to the forge bridge, in order (the old form of
|
||||
// the merge: eb131beb, the merge as an owed act, is left out of the join).
|
||||
func (r *runtime) mergesSaid() []string {
|
||||
ctx := context.Background()
|
||||
kv := r.b.kvs["merges"]
|
||||
keys, err := kv.Keys(ctx)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
var out []string
|
||||
for _, k := range keys {
|
||||
hist, err := kv.History(ctx, k)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, e := range hist {
|
||||
out = append(out, k+"@"+strconv.FormatUint(e.Revision(), 10))
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user