25 lines
1.1 KiB
Go
25 lines
1.1 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
// A module only pulled in by another on a node, and handed to the provisioner there, has a value of its own in the
|
|
// assignments mirror (mesh-controller internal/inventory AssignmentValues, issue 765): what requires it, its plan,
|
|
// and no time it was assigned. Its values resolve there like an assigned module's, so the node's client can fill its
|
|
// templates; they go when the value goes.
|
|
func TestAModulePulledInHasItsValuesResolvedOnItsNode(t *testing.T) {
|
|
c, m := aMesh(t)
|
|
if _, err := c.Reconcile(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
m.mirror(t, AssignmentsRead, "ace.dunst", `{"node":"ace","module":"dunst","required-by":"desk",`+
|
|
`"provisioning":{"templates":{"source":"x","digest":"y"},"files":[]}}`)
|
|
if r, err := c.Reconcile(); err != nil || len(r.Moved) != 4 {
|
|
t.Fatalf("a pulled-in module's value moved %+v (%v)", r.Moved, err)
|
|
}
|
|
expect(t, m, "ace", "10", SourceDefault)
|
|
_ = m.Delete(AssignmentsRead, "ace.dunst")
|
|
if r, _ := c.Reconcile(); len(r.Moved) != 4 || !r.Moved[0].Gone {
|
|
t.Errorf("a module no longer pulled in moved %+v", r.Moved)
|
|
}
|
|
}
|