Test that a fill the node-engine failed is tried again when its socket returns (issue 1873)

This commit is contained in:
2026-10-22 22:53:39 +02:00
parent 66c404fd39
commit ab3722d3b3
@@ -106,3 +106,38 @@ func TestWatchSocketWakesWhenTheSocketIsMadeAndWhenItsDirectoryReturns(t *testin
defer l.Close()
heard("the directory and socket back")
}
// Issue 1873: a fill the node-engine refused for a reason of its own (on ace, "read …/superuser.secret: is a
// directory", what a container runtime had left there) is tried again when a node-engine makes its socket again, as a
// newer engine may write what the older could not. Before, only a fill that failed for want of the socket was, so
// ace's postgres stayed unplaced after the engine that cures it was delivered, and its old failure was said every 30 s.
func TestNatsAFillTheEngineFailedIsTriedWhenTheSocketReturns(t *testing.T) {
b := startBus(t)
heard := b.listen(t)
e := newEngine(t, map[string]string{dunstrc: "owned"})
if err := os.MkdirAll(e.at(dunstrc), 0o755); err != nil {
t.Fatal(err)
}
stop := e.listen(t)
b.config(t, "dunst", "font-size", "13")
b.assign(t, "dunst", dunst(t))
aClient(t, b, e, t.TempDir())
eventually(t, "the engine's failure is said", func() bool {
r, _ := heard.last("dunst")
return r.Status == StatusFailed && strings.Contains(r.Reason, "is a directory")
})
// The node-engine replaces itself with one that clears what the runtime left.
stop()
if err := os.Remove(e.at(dunstrc)); err != nil {
t.Fatal(err)
}
e.listen(t)
eventually(t, "dunstrc is written by the new engine", func() bool {
return strings.Contains(e.read(t, dunstrc), "Monospace 13")
})
eventually(t, "and the report says applied", func() bool {
r, _ := heard.last("dunst")
return r.Status == StatusApplied
})
}