I3 needs-rules: TestIndexerWhole holds the need rules on each revision and the derivation of the unmoved entries' needs
Builds: design 47 H2 H-A-569 (2), H-A-605 (4), H-A-586
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"git.novox.be/novox/mesh-sdk/go/views"
|
||||
|
||||
"mesh-delivery-indexer/internal/index"
|
||||
"mesh-delivery-indexer/judge"
|
||||
)
|
||||
|
||||
// waitBound is how long a bed waits for what the indexer says or writes; a wait is on the bus (an event, a watch), never a sleep.
|
||||
@@ -500,6 +501,45 @@ func TestIndexerWhole(t *testing.T) {
|
||||
}
|
||||
untilKey(t, ctx, pins, index.PinKey("main", r(11)), pinned("pipeline."+rn(11)))
|
||||
untilKey(t, ctx, pins, index.PinKey("main", r(10)), pinned("pipeline."+rn(11))) // validate's base, H-A-147
|
||||
// Design 47 H2 H-A-569 (2), H-A-605 (4) (AC-I3): every revision carries the validator's need rules. The bed's seed, main.1,
|
||||
// was kept with none, so main.2 derived each unmoved entry's needs from its manifest again; main.3, at the same rules as
|
||||
// its base, derives none.
|
||||
firstRev, firstEntries, err := index.ReadRevision(ctx, objects, rn(10))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
nextRev, nextEntries, err := index.ReadRevision(ctx, objects, rn(11))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if firstRev.NeedsRules != judge.NeedsRules || nextRev.NeedsRules != judge.NeedsRules {
|
||||
t.Errorf("the revisions carry the need rules %d and %d, want %d", firstRev.NeedsRules, nextRev.NeedsRules, judge.NeedsRules)
|
||||
}
|
||||
derivedFor, derivedNeeds := 0, 0
|
||||
for _, e := range firstEntries {
|
||||
raw, _ := json.Marshal(e.Manifest)
|
||||
derived, err := judge.ManifestNeeds(raw)
|
||||
if len(e.Manifest) == 0 || err != nil {
|
||||
continue
|
||||
}
|
||||
derivedFor++
|
||||
derivedNeeds += len(derived)
|
||||
for _, need := range derived {
|
||||
if !slices.Contains(e.Needs, need) {
|
||||
t.Errorf("%s of main.2 carries needs %v, want %q its manifest names under the rules now", e.Module, e.Needs, need)
|
||||
}
|
||||
}
|
||||
}
|
||||
if derivedFor == 0 || derivedNeeds == 0 {
|
||||
t.Errorf("%d unmoved entries of main.2 carry a manifest, deriving %d needs: no derivation was held", derivedFor, derivedNeeds)
|
||||
}
|
||||
// The bed's seeded entries were written to no state, so a take-in at unchanged rules, which derives nothing, carries the needs
|
||||
// the state holds for them: none.
|
||||
for _, e := range nextEntries {
|
||||
if e.Module != "avahi" && len(e.Needs) != 0 {
|
||||
t.Errorf("%s of main.3 carries needs %v, want none derived in a take-in at the rules of its base", e.Module, e.Needs)
|
||||
}
|
||||
}
|
||||
info, err := objects.open(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user