Name no node in mesh-provisioner's and home-assistant's fixtures (issue 1838)
This commit is contained in:
@@ -170,15 +170,15 @@ func clientWrites(t *testing.T) *memStore {
|
||||
if _, _, err := Publish(s); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s.write(t, Needs, "g14.dunst.config.font-size", `{"at":"2026-10-14T20:00:00Z"}`)
|
||||
s.write(t, Needs, "g14.dunst.secret.token", `{}`)
|
||||
s.write(t, Needs, "shanks.dunst.config.font-size", `{}`)
|
||||
s.write(t, Needs, "shanks.gitea.bound.database.user", `{}`)
|
||||
s.write(t, Applied, "g14.dunst", `{"build":"b1","outcome":"applied"}`)
|
||||
s.write(t, Applied, "shanks.dunst", `{"build":"b1","outcome":"failed","reason":"waits for config font-size"}`)
|
||||
s.write(t, Collect, "g14.zsh-snippets.git", `{}`)
|
||||
s.write(t, Collect, "g14.bar-blocks.disk-load", `{}`)
|
||||
s.write(t, Collect, "g14.shell=3Azsh=3Anormal.mesh-cli", `{}`)
|
||||
s.write(t, Needs, "node-b.dunst.config.font-size", `{"at":"2026-10-14T20:00:00Z"}`)
|
||||
s.write(t, Needs, "node-b.dunst.secret.token", `{}`)
|
||||
s.write(t, Needs, "node-d.dunst.config.font-size", `{}`)
|
||||
s.write(t, Needs, "node-d.gitea.bound.database.user", `{}`)
|
||||
s.write(t, Applied, "node-b.dunst", `{"build":"b1","outcome":"applied"}`)
|
||||
s.write(t, Applied, "node-d.dunst", `{"build":"b1","outcome":"failed","reason":"waits for config font-size"}`)
|
||||
s.write(t, Collect, "node-b.zsh-snippets.git", `{}`)
|
||||
s.write(t, Collect, "node-b.bar-blocks.disk-load", `{}`)
|
||||
s.write(t, Collect, "node-b.shell=3Azsh=3Anormal.mesh-cli", `{}`)
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -199,16 +199,16 @@ func TestEachBucketIsReadByItsShapeAndNarrowed(t *testing.T) {
|
||||
}{
|
||||
{Query{}, []string{"access", "backup", "bound", "collected", "config", "consumers", "contribution", "dir", "environment",
|
||||
"machine", "port", "seat", "secret", "shell"}},
|
||||
{Query{What: Needs}, []string{"g14.dunst.config.font-size", "g14.dunst.secret.token",
|
||||
"shanks.dunst.config.font-size", "shanks.gitea.bound.database.user"}},
|
||||
{Query{What: Needs, Node: "g14"}, []string{"g14.dunst.config.font-size", "g14.dunst.secret.token"}},
|
||||
{Query{What: Needs, Module: "dunst", Node: "shanks"}, []string{"shanks.dunst.config.font-size"}},
|
||||
{Query{What: Applied, Module: "dunst"}, []string{"g14.dunst", "shanks.dunst"}},
|
||||
{Query{What: Applied, Node: "ace"}, nil},
|
||||
{Query{What: Collect, Collection: "zsh-snippets"}, []string{"g14.zsh-snippets.git"}},
|
||||
{Query{What: Collect, Module: "disk-load"}, []string{"g14.bar-blocks.disk-load"}},
|
||||
{Query{What: Needs}, []string{"node-b.dunst.config.font-size", "node-b.dunst.secret.token",
|
||||
"node-d.dunst.config.font-size", "node-d.gitea.bound.database.user"}},
|
||||
{Query{What: Needs, Node: "node-b"}, []string{"node-b.dunst.config.font-size", "node-b.dunst.secret.token"}},
|
||||
{Query{What: Needs, Module: "dunst", Node: "node-d"}, []string{"node-d.dunst.config.font-size"}},
|
||||
{Query{What: Applied, Module: "dunst"}, []string{"node-b.dunst", "node-d.dunst"}},
|
||||
{Query{What: Applied, Node: "node-a"}, nil},
|
||||
{Query{What: Collect, Collection: "zsh-snippets"}, []string{"node-b.zsh-snippets.git"}},
|
||||
{Query{What: Collect, Module: "disk-load"}, []string{"node-b.bar-blocks.disk-load"}},
|
||||
// An old namespace's collection, by its name, not its key's token (design 57 L1).
|
||||
{Query{What: Collect, Collection: "shell:zsh:normal"}, []string{"g14.shell=3Azsh=3Anormal.mesh-cli"}},
|
||||
{Query{What: Collect, Collection: "shell:zsh:normal"}, []string{"node-b.shell=3Azsh=3Anormal.mesh-cli"}},
|
||||
} {
|
||||
r, err := Do(s, c.q)
|
||||
if err != nil {
|
||||
@@ -218,15 +218,15 @@ func TestEachBucketIsReadByItsShapeAndNarrowed(t *testing.T) {
|
||||
t.Errorf("%+v: read %v (%d), want %v", c.q, got, r.Count, c.want)
|
||||
}
|
||||
}
|
||||
r, _ := Do(s, Query{What: Needs, Node: "shanks", Module: "gitea"})
|
||||
if row := r.Rows[0]; row.Node != "shanks" || row.Module != "gitea" || row.Kind != "bound" || row.Name != "database.user" {
|
||||
r, _ := Do(s, Query{What: Needs, Node: "node-d", Module: "gitea"})
|
||||
if row := r.Rows[0]; row.Node != "node-d" || row.Module != "gitea" || row.Kind != "bound" || row.Name != "database.user" {
|
||||
t.Errorf("a need's parts: %+v", row)
|
||||
}
|
||||
r, _ = Do(s, Query{What: Collect, Collection: "bar-blocks"})
|
||||
if row := r.Rows[0]; row.Node != "g14" || row.Collection != "bar-blocks" || row.Module != "disk-load" {
|
||||
if row := r.Rows[0]; row.Node != "node-b" || row.Collection != "bar-blocks" || row.Module != "disk-load" {
|
||||
t.Errorf("an item's parts: %+v", row)
|
||||
}
|
||||
r, _ = Do(s, Query{What: Applied, Node: "shanks"})
|
||||
r, _ = Do(s, Query{What: Applied, Node: "node-d"})
|
||||
if string(r.Rows[0].Value) != `{"build":"b1","outcome":"failed","reason":"waits for config font-size"}` {
|
||||
t.Errorf("what is applied is read as the client wrote it: %s", r.Rows[0].Value)
|
||||
}
|
||||
@@ -235,12 +235,12 @@ func TestEachBucketIsReadByItsShapeAndNarrowed(t *testing.T) {
|
||||
// A key out of its bucket's shape is said, never dropped quietly.
|
||||
func TestAKeyOutOfItsBucketsShapeIsSaid(t *testing.T) {
|
||||
s := clientWrites(t)
|
||||
s.write(t, Applied, "g14.dunst.extra", `{}`)
|
||||
s.write(t, Applied, "node-b.dunst.extra", `{}`)
|
||||
r, err := Do(s, Query{What: Applied})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if r.Count != 2 || !strings.Contains(r.Said, "g14.dunst.extra") || !strings.Contains(r.Said, "<node>.<module>") {
|
||||
if r.Count != 2 || !strings.Contains(r.Said, "node-b.dunst.extra") || !strings.Contains(r.Said, "<node>.<module>") {
|
||||
t.Errorf("an unshaped key: %d rows, said %q", r.Count, r.Said)
|
||||
}
|
||||
}
|
||||
@@ -253,21 +253,21 @@ func TestTheVerbsArgumentsAreReadStrictly(t *testing.T) {
|
||||
t.Fatalf("the verb is served as %s", Tools(s)[0].Name)
|
||||
}
|
||||
for _, args := range []map[string]any{
|
||||
{"what": "needs", "caller": "g14.dunst"},
|
||||
{"what": "needs", "caller": "node-b.dunst"},
|
||||
{"node": 3},
|
||||
{"what": "secrets"},
|
||||
{"node": "g14"},
|
||||
{"node": "node-b"},
|
||||
{"what": "needs", "collection": "zsh-snippets"},
|
||||
} {
|
||||
if _, err := run(args); err == nil {
|
||||
t.Errorf("%v was taken", args)
|
||||
}
|
||||
}
|
||||
got, err := run(map[string]any{"what": "applied", "node": " g14 "})
|
||||
got, err := run(map[string]any{"what": "applied", "node": " node-b "})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if r := got.(Read); r.Count != 1 || r.Said != "1 in applied for node g14" {
|
||||
if r := got.(Read); r.Count != 1 || r.Said != "1 in applied for node node-b" {
|
||||
t.Errorf("a read: %+v", r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user