mesh-delivery-assigner: the validate test judges a revision whose base is below its number minus one
Every revision the validate test judged with a base had it at its number minus one, so the test passed with the case before read as the number before (review round 1). Revision 12 now names base 7 with 8 to 11 never kept: it ends manifest-refused against base 7's manifests, and could not run when the case before is read as the number minus one. No test added. Builds: design 47 H-A-154 (hq design/47-H1-answers-59 01842bbe), H-A-151
This commit is contained in:
@@ -34,9 +34,14 @@ func TestTheValidateStepRefusesAManifestProblemAndACycle(t *testing.T) {
|
|||||||
7: {indexer, entry("web", "d-web-2"), entry("db", "d-db")},
|
7: {indexer, entry("web", "d-web-2"), entry("db", "d-db")},
|
||||||
9: {indexer, entry("a", "d-a", meshcatalog.Edge{From: "a:x", To: "b:y", Kind: 3}, meshcatalog.Edge{From: "b:y", To: "a:x", Kind: 3}), entry("b", "d-b")},
|
9: {indexer, entry("a", "d-a", meshcatalog.Edge{From: "a:x", To: "b:y", Kind: 3}, meshcatalog.Edge{From: "b:y", To: "a:x", Kind: 3}), entry("b", "d-b")},
|
||||||
3: {indexer},
|
3: {indexer},
|
||||||
|
12: {indexer, entry("web", "d-web-2"), entry("db", "d-db")},
|
||||||
}
|
}
|
||||||
// base is the newest kept revision below n, as the take-in names it; none below the first.
|
// base is the newest kept revision below n, as the take-in names it; none below the first. Revision 12 names 7 with 8 to 11
|
||||||
|
// never kept, so a case before read as the number minus one could not run (H-A-154).
|
||||||
base := func(n int64) (b int64) {
|
base := func(n int64) (b int64) {
|
||||||
|
if n == 12 {
|
||||||
|
return 7
|
||||||
|
}
|
||||||
for k := range revisions {
|
for k := range revisions {
|
||||||
if k < n && k > b {
|
if k < n && k > b {
|
||||||
b = k
|
b = k
|
||||||
@@ -134,4 +139,12 @@ func TestTheValidateStepRefusesAManifestProblemAndACycle(t *testing.T) {
|
|||||||
o.Said != reasonManifestRefused+`: web: unknown field "colour" (`+emptyBeforeWords+")" || len(asks) != 2 || len(requests[1].Cases[1].Manifests) != 0 {
|
o.Said != reasonManifestRefused+`: web: unknown field "colour" (`+emptyBeforeWords+")" || len(asks) != 2 || len(requests[1].Cases[1].Manifests) != 0 {
|
||||||
t.Errorf("a revision naming no base ended %+v (%d validator asks), want it judged against an empty case before, said", o, len(asks))
|
t.Errorf("a revision naming no base ended %+v (%d validator asks), want it judged against an empty case before, said", o, len(asks))
|
||||||
}
|
}
|
||||||
|
// Revision 12 holds revision 7's manifests and names base 7: judged against it, web's problem is the revision's, db's old one
|
||||||
|
// is not, and the case before holds base 7's manifests.
|
||||||
|
if o := r.validate(ctx, "ask-base", step("web", 12)); o.Outcome != meshwants.StepEndedOutcomeFailed ||
|
||||||
|
o.Said != reasonManifestRefused+`: web: unknown field "colour"` || len(asks) != 3 {
|
||||||
|
t.Errorf("a revision naming base 7 below its number ended %+v (%d validator asks), want it judged against base 7", o, len(asks))
|
||||||
|
} else if web := requests[2].Cases[1].Manifests["web"]; len(requests[2].Cases[1].Manifests) != 3 || !strings.Contains(string(web.Raw), "d-web-2") {
|
||||||
|
t.Errorf("the case before of revision 12 is %+v, want base 7's manifests", requests[2].Cases[1].Manifests)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user