Grants first could hold back the very declaration that lets the controller issue them. The holder now goes first, then buckets and memberships, then the rest; a membership that fails holds back only its own machine, and an announcement whose send stopped at its grants is asked again. Whether the holder must go first is read from a digest of the user list it was last sent, not its whole declaration. Migration renumbered to 0058.
26 lines
871 B
Go
26 lines
871 B
Go
package inventory
|
|
|
|
import "testing"
|
|
|
|
// novox/hq issue 249: the digest of the user list a machine was last sent is kept, by its name, and
|
|
// is empty for a machine never sent one.
|
|
func TestTheUserListAMachineWasSentIsKept(t *testing.T) {
|
|
inv := ForTest(t)
|
|
ctx := t.Context()
|
|
if _, err := inv.AddNode(ctx, "anchor"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if sent, err := inv.SentBusUsers(ctx, "anchor"); err != nil || sent != "" {
|
|
t.Fatalf("a machine never sent a list has %q: %v", sent, err)
|
|
}
|
|
if err := inv.RecordSentBusUsers(ctx, "anchor", "abc"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if sent, err := inv.SentBusUsers(ctx, "anchor"); err != nil || sent != "abc" {
|
|
t.Fatalf("the list sent was not kept: %q %v", sent, err)
|
|
}
|
|
if sent, err := inv.SentBusUsers(ctx, "nobody"); err != nil || sent != "" {
|
|
t.Fatalf("a machine the mesh does not know: %q %v", sent, err)
|
|
}
|
|
}
|