28 lines
895 B
Go
28 lines
895 B
Go
//go:build integration
|
|
|
|
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)
|
|
}
|
|
}
|