Keep the builds every want names and each composition's provisioner plans; find the replaced controller in the build records (issue 1945)
With no plan left to name a build or a send to keep the plans, a want names what a collection must keep, and the composition is where the provisioner's plans are composed for the assignments mirror (ADR 0539 clauses 1 and 5); the assignments no longer name a node's build, so the controller replaced is the newest earlier build of it.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// 1945 (dev-r6-controller's finding): the provisioner's plans a composition hands are kept in the shape the
|
||||
// assignments mirror reads (inventory.SentProvisioningPlans: each module's plan and what requires it), and a
|
||||
// composition that hands none keeps none.
|
||||
func TestAComposedNodesProvisionerPlansAreKept(t *testing.T) {
|
||||
if plansKept(sendable{}) != nil {
|
||||
t.Errorf("a composition that hands nothing kept plans")
|
||||
}
|
||||
d := sendable{plans: map[string]catalogue.Plan{"umami": {Placement: map[string]string{"dir:state": "/var/lib/umami"}}},
|
||||
requiredBy: map[string]string{"umami": "analytics"}}
|
||||
var kept map[string]struct {
|
||||
Placement map[string]string `json:"placement"`
|
||||
RequiredBy string `json:"required-by"`
|
||||
}
|
||||
if err := json.Unmarshal(plansKept(d), &kept); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if kept["umami"].Placement["dir:state"] != "/var/lib/umami" || kept["umami"].RequiredBy != "analytics" {
|
||||
t.Errorf("kept %+v", kept)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user