Merge pull request 'Play the config watch in the package seats' whole test, so the held callers list is proven (issue 1966)' (#652) from fix/1966-registry-test-watch into main
This commit was merged in pull request #652.
This commit is contained in:
@@ -6,7 +6,7 @@ package main
|
|||||||
// the built package-registry bundle, played over its real stdin and stdout as the node's tool runtime plays it, its
|
// the built package-registry bundle, played over its real stdin and stdout as the node's tool runtime plays it, its
|
||||||
// `incoming` an object store and its `transfers` and `findings` key-value buckets of a nats-server of this test alone
|
// `incoming` an object store and its `transfers` and `findings` key-value buckets of a nats-server of this test alone
|
||||||
// (so the publish in parts runs through mesh-sdk's parts.BusObjects and BusTransfers, ruling 4 of the lead's 14:0x), the
|
// (so the publish in parts runs through mesh-sdk's parts.BusObjects and BusTransfers, ruling 4 of the lead's 14:0x), the
|
||||||
// builder's builder_versions answered on mesh/ask, the config value `callers` on mesh/provision.get, and the forge an
|
// builder's builder_versions answered on mesh/ask, the config value `callers` watched on mesh/provision.watch, and the forge an
|
||||||
// httptest server that takes reads only with the tools' token and writes only with the packages account's.
|
// httptest server that takes reads only with the tools' token and writes only with the packages account's.
|
||||||
//
|
//
|
||||||
// A Go package the builder numbered goes up in two chunks, is uploaded whole as the packages account and says
|
// A Go package the builder numbered goes up in two chunks, is uploaded whole as the packages account and says
|
||||||
@@ -123,8 +123,12 @@ func (p *player) handle(m wire) {
|
|||||||
_ = json.Unmarshal(a.Body, &q)
|
_ = json.Unmarshal(a.Body, &q)
|
||||||
d, ok := p.numbered[q.Name+"@"+q.Version]
|
d, ok := p.numbered[q.Name+"@"+q.Version]
|
||||||
p.answer(m.ID, map[string]any{"recorded": ok && d == q.Digest, "why": "not numbered with that digest"}, nil)
|
p.answer(m.ID, map[string]any{"recorded": ok && d == q.Digest, "why": "not numbered with that digest"}, nil)
|
||||||
case m.Method == "mesh/provision.get" && a.Kind == "config":
|
case m.Method == "mesh/provision.watch" && a.Kind == "config":
|
||||||
p.answer(m.ID, nil, nil) // `callers` unset: design 51's list
|
// The watch of `callers`, as the runtime answers it: the value now as one change (mesh/provision,
|
||||||
|
// named by the watch's id) handed over before the watch is answered, here unset, so design 51's list holds.
|
||||||
|
p.send(map[string]any{"id": "change-" + watchID(m.ID), "method": "mesh/provision", "params": map[string]any{
|
||||||
|
"watch": watchID(m.ID), "change": map[string]any{"kind": "config", "key": a.Key}}})
|
||||||
|
p.answer(m.ID, map[string]any{}, nil)
|
||||||
case m.Method == "mesh/seat.publish":
|
case m.Method == "mesh/seat.publish":
|
||||||
p.answer(m.ID, map[string]any{}, p.nc.Publish(a.Subject, a.Body))
|
p.answer(m.ID, map[string]any{}, p.nc.Publish(a.Subject, a.Body))
|
||||||
case m.Method == "mesh/publish":
|
case m.Method == "mesh/publish":
|
||||||
@@ -138,6 +142,15 @@ func (p *player) handle(m wire) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// watchID is the watch's id as a string, the form the change names it by.
|
||||||
|
func watchID(raw json.RawMessage) string {
|
||||||
|
var id string
|
||||||
|
if json.Unmarshal(raw, &id) != nil {
|
||||||
|
return string(raw)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
func (p *player) objects(m wire, local, name string, data []byte) {
|
func (p *player) objects(m wire, local, name string, data []byte) {
|
||||||
os, err := p.js.ObjectStore(p.ctx, "gitea_"+local)
|
os, err := p.js.ObjectStore(p.ctx, "gitea_"+local)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user