Return the lines the composition found on the way (a node not counted as on the network) in Rendered.Said and Declared.Said (review round 1, finding 6). The test failed first; the suite is 1258 tests in 1.05 s
This commit is contained in:
@@ -382,3 +382,37 @@ func TestTheRestOfTheMeshReadsEachOtherNodesKeptBuild(t *testing.T) {
|
||||
t.Errorf("a node keeping a build that offers nothing still offers: %v %v", providers(w, "s3-bucket"), err)
|
||||
}
|
||||
}
|
||||
|
||||
// Round 1, finding 6: the nodes the composition did not count as on the network are returned, said, not lost.
|
||||
func TestANodeNotCountedAsOnTheNetworkIsSaidInTheResult(t *testing.T) {
|
||||
in := aMesh(t)
|
||||
in.Catalogue["rival-one"] = catalogue.Manifest{Module: "rival-one", Version: "1", Claims: []catalogue.Claim{{Name: "the-seat", Scope: catalogue.ScopeNode}}}
|
||||
in.Catalogue["rival-two"] = catalogue.Manifest{Module: "rival-two", Version: "1", Claims: []catalogue.Claim{{Name: "the-seat", Scope: catalogue.ScopeNode}}}
|
||||
laptop := nodeOf(t, &in, "laptop")
|
||||
laptop.Assigned = append(laptop.Assigned, "rival-one", "rival-two")
|
||||
said := func(lines []string) bool {
|
||||
for _, l := range lines {
|
||||
if strings.HasPrefix(l, "laptop is not counted as on the network") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
got, err := Render(in, "anchor", Foreseeing)
|
||||
if err != nil || !said(got.Said) {
|
||||
t.Errorf("rendered: %v %v", got.Said, err)
|
||||
}
|
||||
d, _, err := Compose(in, "anchor")
|
||||
if err != nil || !said(d.Said) {
|
||||
t.Errorf("declared: %v %v", d.Said, err)
|
||||
}
|
||||
n := 0
|
||||
for _, l := range d.Said {
|
||||
if strings.HasPrefix(l, "laptop is not counted") {
|
||||
n++
|
||||
}
|
||||
}
|
||||
if n != 1 {
|
||||
t.Errorf("said %d times: %v", n, d.Said)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user