Relate a batch whose moves are not known to every change
The review found that a merge kept without its moves, judged again at the cut, gave its batch no modules, so it could read as unrelated to a walk it will build beside. An unknown change is never unrelated.
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/novox/mesh-controller/internal/inventory"
|
||||
@@ -90,3 +91,20 @@ func TestFootprintOfBatchWidensToDependents(t *testing.T) {
|
||||
t.Errorf("footprint = %+v; want base-image and nzbget, no head", f)
|
||||
}
|
||||
}
|
||||
|
||||
// A batch holding a merge kept with no moves (one owed a later look, judged again at the cut) is related to
|
||||
// every change, in both orders: what it will move is not known, and an unknown change is never unrelated
|
||||
// (issue 525 review).
|
||||
func TestABatchWhoseMovesAreNotKnownIsRelatedToEverything(t *testing.T) {
|
||||
unknown := footprintOfBatch([]inventory.BatchedMerge{heardMerge("novox/one", "fix/a", "app"), heardMerge("novox/two", "fix/b")}, nil)
|
||||
other := footprintOfWalk(walkOf("novox/three", "nzbget"), nil)
|
||||
for _, pair := range [][2]footprint{{unknown, other}, {other, unknown}} {
|
||||
if ok, why := related(pair[0], pair[1], nil); !ok || !strings.Contains(why, "not known") {
|
||||
t.Fatalf("an unknown batch read as %v (%q)", ok, why)
|
||||
}
|
||||
}
|
||||
known := footprintOfBatch([]inventory.BatchedMerge{heardMerge("novox/one", "fix/a", "app")}, nil)
|
||||
if ok, why := related(known, other, nil); ok {
|
||||
t.Fatalf("a known, unrelated batch read as related: %q", why)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user