Files
mesh-catalog/modules/mesh-mail-notifier/cmd/mesh-mail-notifier/manifest_test.go
T
jochen 31120ed580
mesh/merge-gate head 31120ed58029 merged into trunk c9848f4fb85c — pass: builds mesh-mail-notifier → g14, shanks; no bus step; every machine composes with …
mesh/repo-check head 31120ed58029 merged into trunk c9848f4fb85c — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-…
mesh/delivery delivered
mesh-mail-notifier: watch retries a subscribe refusal instead of exiting (issue 859, review round 1)
A subscribe the runtime refuses no longer calls os.Exit(1), which took mail-notifier.status and
mail_notifier_health down with it: watch now retries with backoff (2s doubling to 1 minute), logging each
refusal, as mesh-knowledge's hear does. Also: the run() test proves liveness by having the watcher answer a
ping after run returns, instead of checking a channel only the test's own deferred cleanup could close; and
the manifest test is renamed to say what it checks (no process resource at all).
2026-10-15 23:17:14 +02:00

39 lines
1.1 KiB
Go

package main
import (
"encoding/json"
"os"
"path/filepath"
"testing"
)
// The manifest's own shape (novox/hq issue 859): the watch loop runs in the base invocation beside
// stdio.Serve, so no resource declares a separate `notify` process any more — the thing that exited at once,
// every five seconds, because a systemd-run process's stdin is empty and stdio.Serve returns at EOF.
type manifestResources struct {
Resources []map[string]any `json:"resources"`
}
func readManifestResources(t *testing.T) manifestResources {
t.Helper()
raw, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
if err != nil {
t.Fatal(err)
}
var m manifestResources
if err := json.Unmarshal(raw, &m); err != nil {
t.Fatalf("module.json: %v", err)
}
return m
}
func TestNoProcessResourceIsDeclared(t *testing.T) {
m := readManifestResources(t)
for _, r := range m.Resources {
if r["type"] == "process" {
t.Fatalf("module.json still declares a process resource (%v): the watcher runs in the base invocation now, not a separate process (novox/hq issue 859)", r)
}
}
}