selfcompose: the manifest of the build a module runs here is answered in one place; every step reads it there (A-484)
Entry of the running build, else the composition this node runs of it, else the module's trunk manifest through the seat mesh-catalog's verb module; said once per module and source; words naming the three where none answers. Read there: a held module's offer (frombus Scope.RunningManifest), FormChanges (A-483), the store holder and the stand of a running module without an entry (A-461d, A-480a), and the tool composition. Builds: design 47 G A-484, A-480, A-480a, A-483, A-461d, A-482
This commit is contained in:
@@ -291,7 +291,7 @@ func runningModuleWithoutEntryStandsAsTheNewestBuild(t *testing.T) {
|
||||
{"heard no running event, its have says running (A-480a, A-482)", false, "", false, true, old, false, true, "running", ""},
|
||||
{"heard no running event, its have says held (A-482)", false, "", false, true, old, false, true, "held", ""},
|
||||
{"wanted here, heard no running event, no have (A-482)", false, "", false, false, old, false, true, "", ""},
|
||||
{"its running event names a manifest this node holds (A-480a)", true, "", false, false, old, false, true, "", "held"},
|
||||
{"its running event names a manifest this node holds: no source of the one place (A-484)", true, "", false, true, old, false, true, "", "held"},
|
||||
{"its running event names a manifest this node cannot read (A-480a)", true, "", false, true, old, false, true, "", "unread"},
|
||||
{"runs a composition at another build, no manifest read (A-480a)", true, "", false, true, old, false, true, "other", ""},
|
||||
{"heard stopped, trunk entry held (A-480a)", false, "", false, false, old, true, true, "running", ""},
|
||||
@@ -302,7 +302,9 @@ func runningModuleWithoutEntryStandsAsTheNewestBuild(t *testing.T) {
|
||||
trunkFp := meshcatalogclient.SourcePrefix2 + strings.Repeat("4", 64)
|
||||
env.Entry = EntryCall(func(_ context.Context, _, verb string, _ any) (json.RawMessage, error) {
|
||||
if verb == meshcatalog.VerbModule && tc.trunk {
|
||||
return json.Marshal(meshcatalog.ModuleAnswer{Module: meshcatalog.ModuleAnswerModule{Fp: trunkFp}})
|
||||
var man map[string]any
|
||||
_ = json.Unmarshal([]byte(body), &man)
|
||||
return json.Marshal(meshcatalog.ModuleAnswer{Module: meshcatalog.ModuleAnswerModule{Fp: trunkFp, Manifest: man}})
|
||||
}
|
||||
return nil, errors.New("not held")
|
||||
})
|
||||
@@ -426,6 +428,27 @@ func TestRunningBuildEntryKeptAndHandedAgain(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// A-484: where neither the entry nor a composition answers, the trunk's manifest is the running build's: a form change is judged
|
||||
// against it, and its words name the three sources where the trunk answered none either.
|
||||
for _, trunk := range []bool{true, false} {
|
||||
env := newFakeBus().env()
|
||||
env.Node = "n1"
|
||||
c := New(env)
|
||||
c.holdEntry(t, "feh", next, `{"module":"feh","version":"2","data":{"own":[{"id":"state","kind":"state"}]}}`)
|
||||
if trunk {
|
||||
c.mu.Lock()
|
||||
c.trunkBuilds = map[string]trunkBuild{"feh": {running: old, fp: next, manifest: map[string]any{"module": "feh", "version": "1"}}}
|
||||
c.mu.Unlock()
|
||||
}
|
||||
changes, err := c.FormChanges(context.Background(), "feh", old, next)
|
||||
switch {
|
||||
case trunk && err != nil:
|
||||
t.Errorf("the trunk's manifest answers, FormChanges = %v, %v", changes, err)
|
||||
case !trunk && (err == nil || !strings.Contains(err.Error(), SourceEntry) || !strings.Contains(err.Error(), SourceComposition) || !strings.Contains(err.Error(), SourceTrunk)):
|
||||
t.Errorf("no source answers, FormChanges says %v, want the three named", err)
|
||||
}
|
||||
}
|
||||
|
||||
// A-461, A-461a, A-461b: another node's module whose running build has no entry is laid from the entry of the build the assignment
|
||||
// places for it on that node, or, where the placement names none, of its trunk build; with neither entry it stays as its name
|
||||
// alone, and this node's own module is never laid from a placement.
|
||||
@@ -453,7 +476,11 @@ func TestRunningBuildEntryKeptAndHandedAgain(t *testing.T) {
|
||||
env.Node = "n1"
|
||||
env.Entry = EntryCall(func(_ context.Context, _, verb string, _ any) (json.RawMessage, error) {
|
||||
if verb == meshcatalog.VerbModule {
|
||||
return json.Marshal(meshcatalog.ModuleAnswer{Module: meshcatalog.ModuleAnswerModule{Fp: tc.trunk}})
|
||||
var man map[string]any
|
||||
if tc.trunk != "" {
|
||||
man = map[string]any{"module": "distribution", "version": "2"}
|
||||
}
|
||||
return json.Marshal(meshcatalog.ModuleAnswer{Module: meshcatalog.ModuleAnswerModule{Fp: tc.trunk, Manifest: man}})
|
||||
}
|
||||
return nil, errors.New("not held")
|
||||
})
|
||||
@@ -481,7 +508,7 @@ func TestRunningBuildEntryKeptAndHandedAgain(t *testing.T) {
|
||||
if tc.node == "n2" && tc.build == "" && tc.trunk == "" && kept {
|
||||
t.Error("a trunk build that could not be had was kept, so it is asked once per process (A-461e)")
|
||||
}
|
||||
if _, asked := c.wantedBuilds()[placedFp]; asked != (tc.node == "n2" && (tc.build != "" || tc.trunk != "")) {
|
||||
if _, asked := c.wantedBuilds()[placedFp]; asked != (tc.node == "n2" && tc.build != "") {
|
||||
t.Errorf("the placed build asked = %v", asked)
|
||||
}
|
||||
c.layModules()
|
||||
|
||||
Reference in New Issue
Block a user