Carry an unassigned port as the declaration publishes it, refusing only a port a module does not listen on (issue 774, research 072 row 34)
mesh/delivery merged: source.main moved to novox/mesh-sdk@fea48f19cea5
mesh/delivery-group group fix/route-ports merged: every member is merged
mesh/check failed: integration: mesh-vault/cmd/mesh-vault.TestTheVaultWholeMintsOnTheBusWhoeverHoldsTheLease: never: the account minted under the cont…
mesh/delivery merged: source.main moved to novox/mesh-sdk@fea48f19cea5
mesh/delivery-group group fix/route-ports merged: every member is merged
mesh/check failed: integration: mesh-vault/cmd/mesh-vault.TestTheVaultWholeMintsOnTheBusWhoeverHoldsTheLease: never: the account minted under the cont…
influxdb and unifi publish bare ports that mesh-placement assigns none: the machine runs them at the software's own number, so a plan refusing them held their whole plan for a route that works.
This commit is contained in:
@@ -245,13 +245,6 @@ func (c *composer) portsFor(node Node, plan catalogue.Resolution, settings catal
|
||||
where = at
|
||||
} else {
|
||||
*foreseen = append(*foreseen, fmt.Sprintf("%s:%d", m.Module, l.Port))
|
||||
if r.Unassigned == nil {
|
||||
r.Unassigned = map[string]map[int]bool{}
|
||||
}
|
||||
if r.Unassigned[m.Module] == nil {
|
||||
r.Unassigned[m.Module] = map[int]bool{}
|
||||
}
|
||||
r.Unassigned[m.Module][l.Port] = true
|
||||
}
|
||||
}
|
||||
if ports[m.Module] == nil {
|
||||
|
||||
@@ -52,12 +52,12 @@ func TestAnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented(
|
||||
if p := got.Rendering.Ports["web"][8080]; p != 8080 {
|
||||
t.Errorf("a port nobody allocated is composed as %d, not as the manifest's own", p)
|
||||
}
|
||||
if len(got.ForeseenPorts) != 1 || got.ForeseenPorts[0] != "web:8080" || !got.Rendering.Unassigned["web"][8080] {
|
||||
t.Errorf("foreseen ports are %v (unassigned %v)", got.ForeseenPorts, got.Rendering.Unassigned)
|
||||
if len(got.ForeseenPorts) != 1 || got.ForeseenPorts[0] != "web:8080" {
|
||||
t.Errorf("foreseen ports are %v", got.ForeseenPorts)
|
||||
}
|
||||
nodeOf(t, &in, "laptop").Ports = map[string]map[int]int{"web": {8080: 20123}}
|
||||
got = placed(t, in, "laptop")
|
||||
if p := got.Rendering.Ports["web"][8080]; p != 20123 || len(got.ForeseenPorts) != 0 || got.Rendering.Unassigned != nil {
|
||||
if p := got.Rendering.Ports["web"][8080]; p != 20123 || len(got.ForeseenPorts) != 0 {
|
||||
t.Errorf("the allocated port is composed as %d (foreseen %v)", p, got.ForeseenPorts)
|
||||
}
|
||||
// A port the module does not publish is not the mesh's to move, so it is never foreseen.
|
||||
@@ -70,7 +70,7 @@ func TestAnAllocatedPortIsComposedAndAnUnallocatedOneIsNamedForeseenNotInvented(
|
||||
t.Errorf("an unpublished port: %v foreseen %v", got.Rendering.Ports, got.ForeseenPorts)
|
||||
}
|
||||
unchanged(t, mk, func(in Input) { placed(t, in, "laptop") })
|
||||
// Only a composition for plans refuses a contribution whose port none assigned (issue 774): a declaration still composes.
|
||||
// Only a composition for plans refuses a contribution whose port the module does not listen on (issue 774).
|
||||
for _, mode := range []Mode{Reading, Foreseeing, Planning} {
|
||||
if got := rendered(t, mk(), "laptop", mode).Rendering; got.Planned != (mode == Planning) {
|
||||
t.Errorf("mode %d composes with Planned %v", mode, got.Planned)
|
||||
|
||||
Reference in New Issue
Block a user