From eac56f9990c583ee008cd03ad90817731eb365f6 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 00:22:05 +0100 Subject: [PATCH] GT1: the gate's whole test over a real bus reads the mover's entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test bus serves the ledger's query the movers index answers, and the take-in's mover is looked for in its own entry, the head counting it. Builds: design 47 H2 ยง809; H-A-391 --- .../cmd/mesh-delivery-gate/bus_test.go | 14 +++++++++++++- .../cmd/mesh-delivery-gate/mergecall_bus_test.go | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go index 4e29de34f..2cbb06ac0 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/bus_test.go @@ -387,13 +387,25 @@ func (r *runtime) answer(m rpcMessage) { return nil, fmt.Errorf("the runtime answers no ask %s in this test", a.Key) } switch m.Method { - case buscalls.LedgerApply, buscalls.LedgerGet: + case buscalls.LedgerApply, buscalls.LedgerGet, buscalls.LedgerQuery: // The gate's ledger `records` (W11.1), as the tool runner keeps it: the record test's ledger in memory. r.b.mu.Lock() defer r.b.mu.Unlock() if r.b.ledger == nil { r.b.ledger = newLedgerFake(r.t) } + if m.Method == buscalls.LedgerQuery { + var in buscalls.QueryRequest + if err := json.Unmarshal(m.Params, &in); err != nil { + return nil, err + } + insts, err := r.b.ledger.Query(in.Index, in.Key) + var a buscalls.QueryAnswer + for _, inst := range insts { + a.Entries = append(a.Entries, buscalls.IndexEntry{Instance: inst}) + } + return a, err + } if m.Method == buscalls.LedgerGet { var in buscalls.InstanceRequest if err := json.Unmarshal(m.Params, &in); err != nil { diff --git a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/mergecall_bus_test.go b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/mergecall_bus_test.go index 129567db4..899aa9b22 100644 --- a/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/mergecall_bus_test.go +++ b/modules/mesh-delivery-gate/cmd/mesh-delivery-gate/mergecall_bus_test.go @@ -75,7 +75,8 @@ func TestAGateWholeTakesAMergeCallAndWatchesTheHeadsOverARealBus(t *testing.T) { rt.until("the take-in's mover in the record", eventWithin, func() bool { b.mu.Lock() defer b.mu.Unlock() - return strings.Contains(string(b.ledger.states[instance]), `"module":"app"`) + mover, _ := MoverInstance(recordMilestone(branch, 1), "app") + return strings.Contains(string(b.ledger.states[mover]), `"module":"app"`) && strings.Contains(string(b.ledger.states[instance]), `"movers":1`) }) if e, _ := b.kvs["source"].Get(ctx, sourceKey); e.Revision() != 1 { t.Fatalf("the merge call heard twice wrote source.%s %d times", escaped, e.Revision())