Read each module's own manifest through mesh-sdk's catalogue reader (H-A-498)
The fifteen desktop modules' tools tests failed on every manifest with "json: unknown field class": a test helper copied into each module decoded module.json into its own struct, refusing unknown fields. Manifest strictness is the catalog check's alone, and the manifest's form is a contract read through mesh-sdk's catalogue package, so the copied `manifest` struct and its reader go from the fifteen desktop modules and pacman; each test reads module.json with catalogue.Decode and asserts only the module's own promises (claims, files, tools) on catalogue.Manifest. Builds: design 47 H2 H-A-498, H-A-498 addendum
This commit is contained in:
@@ -1,85 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// The module's manifest, read the way the catalogue reads it, for the manifest tests. The same in
|
||||
// every desktop module that carries it.
|
||||
|
||||
type manifest struct {
|
||||
Module string `json:"module"`
|
||||
Version string `json:"version"`
|
||||
Moved bool `json:"moved"`
|
||||
Capabilities []string `json:"capabilities"`
|
||||
Requires []string `json:"requires"`
|
||||
Claims []claim `json:"claims"`
|
||||
Seats []any `json:"seats"`
|
||||
Tools []string `json:"tools"`
|
||||
Config map[string]config `json:"config"`
|
||||
Emits []string `json:"emits"`
|
||||
Items []item `json:"items"`
|
||||
Contributions []any `json:"contributions"`
|
||||
Environment *environment `json:"environment"`
|
||||
Shell []shellCode `json:"shell"`
|
||||
Resources []map[string]any `json:"resources"`
|
||||
Build struct {
|
||||
Artifacts []map[string]any `json:"artifacts"`
|
||||
} `json:"build"`
|
||||
}
|
||||
|
||||
// config is one config value as the definition declares it (novox/hq ADR 0348 §4).
|
||||
type config struct {
|
||||
Type string `json:"type"`
|
||||
Description string `json:"description"`
|
||||
Enum []any `json:"enum"`
|
||||
Minimum *float64 `json:"minimum"`
|
||||
Maximum *float64 `json:"maximum"`
|
||||
Pattern string `json:"pattern"`
|
||||
Trusted bool `json:"trusted"`
|
||||
Predefined string `json:"predefined"`
|
||||
Default any `json:"default"`
|
||||
Required bool `json:"required"`
|
||||
Runtime bool `json:"runtime"`
|
||||
}
|
||||
|
||||
type claim struct {
|
||||
Name string `json:"name"`
|
||||
Scope string `json:"scope"`
|
||||
Serves []string `json:"serves"`
|
||||
}
|
||||
|
||||
type environment struct {
|
||||
Variables map[string]string `json:"variables"`
|
||||
Path []map[string]any `json:"path"`
|
||||
}
|
||||
|
||||
type shellCode struct {
|
||||
For string `json:"for"`
|
||||
Slot string `json:"slot"`
|
||||
Code string `json:"code"`
|
||||
}
|
||||
|
||||
func readManifest(t *testing.T) manifest {
|
||||
t.Helper()
|
||||
raw, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
dec := json.NewDecoder(strings.NewReader(string(raw)))
|
||||
dec.DisallowUnknownFields()
|
||||
var m manifest
|
||||
if err := dec.Decode(&m); err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func (m manifest) resource(t *testing.T, id string) map[string]any {
|
||||
func resource(t *testing.T, m catalogue.Manifest, id string) map[string]any {
|
||||
t.Helper()
|
||||
for _, r := range m.Resources {
|
||||
if r["id"] == id {
|
||||
@@ -90,7 +20,7 @@ func (m manifest) resource(t *testing.T, id string) map[string]any {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m manifest) packages() (present, absent []string) {
|
||||
func packages(m catalogue.Manifest) (present, absent []string) {
|
||||
for _, r := range m.Resources {
|
||||
if r["type"] == "package" {
|
||||
if r["absent"] == true {
|
||||
@@ -106,9 +36,9 @@ func (m manifest) packages() (present, absent []string) {
|
||||
// fromTemplate checks that a file resource takes its text from its template file in the module's
|
||||
// repository (novox/hq ADR 0349 §2): it names the template, carries no text of its own beside it, and the
|
||||
// template is there. The readable file in the repository is the one place the machine's text is written.
|
||||
func (m manifest) fromTemplate(t *testing.T, id, template string) {
|
||||
func fromTemplate(t *testing.T, m catalogue.Manifest, id, template string) {
|
||||
t.Helper()
|
||||
r := m.resource(t, id)
|
||||
r := resource(t, m, id)
|
||||
if r["type"] != "file" {
|
||||
t.Fatalf("%s is a %v, not a file", id, r["type"])
|
||||
}
|
||||
@@ -128,7 +58,7 @@ func (m manifest) fromTemplate(t *testing.T, id, template string) {
|
||||
|
||||
// everyFileIsATemplate checks that no file resource carries its text inline, and that the build packs
|
||||
// files/ into the one archive the controller reads the templates back from (novox/hq ADR 0349 §2).
|
||||
func (m manifest) everyFileIsATemplate(t *testing.T) {
|
||||
func everyFileIsATemplate(t *testing.T, m catalogue.Manifest) {
|
||||
t.Helper()
|
||||
for _, r := range m.Resources {
|
||||
if _, inline := r["content"]; inline {
|
||||
@@ -137,10 +67,10 @@ func (m manifest) everyFileIsATemplate(t *testing.T) {
|
||||
}
|
||||
packs := 0
|
||||
for _, a := range m.Build.Artifacts {
|
||||
if a["kind"] == "archive" && a["from"] == "files" {
|
||||
if a.Kind == "archive" && a.From == "files" {
|
||||
packs++
|
||||
if a["name"] != "files" {
|
||||
t.Errorf("the templates archive is named %v, not files", a["name"])
|
||||
if a.Name != "files" {
|
||||
t.Errorf("the templates archive is named %v, not files", a.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,9 +80,9 @@ func (m manifest) everyFileIsATemplate(t *testing.T) {
|
||||
}
|
||||
|
||||
// text is the text a file resource places on the machine: its template file's.
|
||||
func (m manifest) text(t *testing.T, id string) string {
|
||||
func templateText(t *testing.T, m catalogue.Manifest, id string) string {
|
||||
t.Helper()
|
||||
name, _ := m.resource(t, id)["template"].(string)
|
||||
name, _ := resource(t, m, id)["template"].(string)
|
||||
if name == "" {
|
||||
t.Fatalf("resource %s names no template", id)
|
||||
}
|
||||
@@ -165,7 +95,7 @@ func (m manifest) text(t *testing.T, id string) string {
|
||||
|
||||
// checkTheToolsAgree checks that the manifest lists the module's own tools exactly, that the bundle
|
||||
// serves each seat verb the claims promise as <seat>.<verb>, and that the Go bundle is declared.
|
||||
func checkTheToolsAgree(t *testing.T, m manifest) {
|
||||
func checkTheToolsAgree(t *testing.T, m catalogue.Manifest) {
|
||||
t.Helper()
|
||||
own, seat := map[string]bool{}, map[string]bool{}
|
||||
for _, tool := range tools() {
|
||||
@@ -207,14 +137,14 @@ func checkTheToolsAgree(t *testing.T, m manifest) {
|
||||
t.Errorf("the bundle serves %s, which no claim promises", name)
|
||||
}
|
||||
}
|
||||
var bundle map[string]any
|
||||
var bundle *catalogue.Artifact
|
||||
for _, a := range m.Build.Artifacts {
|
||||
if a["kind"] == "bundle" {
|
||||
bundle = a
|
||||
if a.Kind == "bundle" {
|
||||
bundle = &a
|
||||
}
|
||||
}
|
||||
if bundle == nil || bundle["language"] != "go" || bundle["system"] != "arch" ||
|
||||
bundle["from"] != "cmd/"+m.Module+"-tools" || bundle["binary"] != m.Module+"-tools" {
|
||||
if bundle == nil || bundle.Language != "go" || bundle.System != "arch" ||
|
||||
bundle.From != "cmd/"+m.Module+"-tools" || bundle.Binary != m.Module+"-tools" {
|
||||
t.Errorf("the Go tools bundle: %v", bundle)
|
||||
}
|
||||
}
|
||||
@@ -239,7 +169,7 @@ const displaySession = "contribution:node-display-session:config"
|
||||
|
||||
// i3Lines is what the module contributes to the window manager: the text of its item of the collection
|
||||
// contribution:node-display-session:config (design 57 L3, issue 848).
|
||||
func (m manifest) i3Lines() string {
|
||||
func i3Lines(m catalogue.Manifest) string {
|
||||
var out string
|
||||
for _, it := range m.Items {
|
||||
if it.Collection == displaySession {
|
||||
@@ -255,7 +185,7 @@ func (m manifest) i3Lines() string {
|
||||
|
||||
// i3LinesAreSource checks the window-manager lines are one item whose template is the source file, and that no
|
||||
// old-form contribution to node-display-session is left.
|
||||
func (m manifest) i3LinesAreSource(t *testing.T, source string) {
|
||||
func i3LinesAreSource(t *testing.T, m catalogue.Manifest, source string) {
|
||||
t.Helper()
|
||||
if len(m.Contributions) != 0 {
|
||||
t.Fatalf("the module still holds contributions: the lines are an item of %s", displaySession)
|
||||
@@ -269,14 +199,7 @@ func (m manifest) i3LinesAreSource(t *testing.T, source string) {
|
||||
if len(templates) != 1 || templates[0] != source {
|
||||
t.Fatalf("the items of %s are %v, want the one template %s", displaySession, templates, source)
|
||||
}
|
||||
if m.i3Lines() == "" {
|
||||
if i3Lines(m) == "" {
|
||||
t.Fatalf("the template %s holds no line", source)
|
||||
}
|
||||
}
|
||||
|
||||
type item struct {
|
||||
Collection string `json:"collection"`
|
||||
Name string `json:"name"`
|
||||
Attributes map[string]string `json:"attributes"`
|
||||
Template string `json:"template"`
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// dunst's shape (novox/hq ADR 0208): it claims node-notifier serving send and history, owns its
|
||||
@@ -12,28 +16,44 @@ import (
|
||||
// activation, so it requires no display of its own.
|
||||
|
||||
func TestItClaimsTheNotifierSeatServingSendAndHistory(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
if m.Module != "dunst" || m.Seats != nil {
|
||||
t.Fatalf("module %q declares seats %v", m.Module, m.Seats)
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(m.Claims, []claim{{Name: "node-notifier", Scope: "node", Serves: []string{"send", "history"}}}) {
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
if m.Module != "dunst" || m.DefinesSeats != nil {
|
||||
t.Fatalf("module %q declares seats %v", m.Module, m.DefinesSeats)
|
||||
}
|
||||
if !reflect.DeepEqual(m.Claims, []catalogue.Claim{{Name: "node-notifier", Scope: "node", Serves: []string{"send", "history"}}}) {
|
||||
t.Fatalf("claims: %+v", m.Claims)
|
||||
}
|
||||
// rofi, the context menu the dunstrc calls by name, is the rofi module's package: two modules on one
|
||||
// machine may not declare the same package, and the rofi module holds node-launcher on every
|
||||
// machine dunst serves.
|
||||
if present, absent := m.packages(); !reflect.DeepEqual(present, []string{"dunst", "libnotify"}) || absent != nil {
|
||||
if present, absent := packages(m); !reflect.DeepEqual(present, []string{"dunst", "libnotify"}) || absent != nil {
|
||||
t.Fatalf("packages: %v, absent %v", present, absent)
|
||||
}
|
||||
}
|
||||
|
||||
func TestItOwnsItsFileAndTheDropInDirectory(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
m.fromTemplate(t, "configuration", "files/dunstrc")
|
||||
if p := m.resource(t, "configuration")["path"]; p != "${machine:account-home}/.config/dunst/dunstrc" {
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
fromTemplate(t, m, "configuration", "files/dunstrc")
|
||||
if p := resource(t, m, "configuration")["path"]; p != "${machine:account-home}/.config/dunst/dunstrc" {
|
||||
t.Fatalf("path: %v", p)
|
||||
}
|
||||
if d := m.resource(t, "dropins"); d["type"] != "directory" || d["path"] != "${machine:account-home}/.config/dunst/dunstrc.d" {
|
||||
if d := resource(t, m, "dropins"); d["type"] != "directory" || d["path"] != "${machine:account-home}/.config/dunst/dunstrc.d" {
|
||||
t.Fatalf("drop-ins: %v", d)
|
||||
}
|
||||
for _, r := range m.Resources {
|
||||
@@ -44,8 +64,16 @@ func TestItOwnsItsFileAndTheDropInDirectory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTheFileIsTheDecidedOneAndCallsRofi(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
c := m.text(t, "configuration")
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
c := templateText(t, m, "configuration")
|
||||
for _, want := range []string{"origin = top-right", "transparency = 0", "corner_radius = 0", "font = Inter ${config:font-size}",
|
||||
"width = ${config:width}", "dmenu = rofi -dmenu -no-custom -p dunst"} {
|
||||
if !strings.Contains(c, " "+want+"\n") {
|
||||
@@ -66,8 +94,16 @@ func TestTheFileIsTheDecidedOneAndCallsRofi(t *testing.T) {
|
||||
// of them (dunst holds it open until the menu answers, and an Escape leaves it shown), and one without
|
||||
// actions closes. Every other click is as it was.
|
||||
func TestATapChoosesTheNotificationsAction(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
c := m.text(t, "configuration")
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
c := templateText(t, m, "configuration")
|
||||
for _, want := range []string{"mouse_left_click = do_action, close_current",
|
||||
"mouse_middle_click = do_action, close_current", "mouse_right_click = close_all"} {
|
||||
if !strings.Contains(c, " "+want+"\n") {
|
||||
@@ -82,9 +118,17 @@ func TestATapChoosesTheNotificationsAction(t *testing.T) {
|
||||
// The key that chooses from the keyboard is a line i3 places from this contribution (novox/hq ADR
|
||||
// 0212): a binding only, never a start, so the bus stays the only thing that starts dunst.
|
||||
func TestTheMenuKeyIsABindingI3Places(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
m.i3LinesAreSource(t, "files/i3/50-dunst.conf")
|
||||
lines := m.i3Lines()
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
i3LinesAreSource(t, m, "files/i3/50-dunst.conf")
|
||||
lines := i3Lines(m)
|
||||
if !strings.Contains(lines, "bindsym $mod+n exec --no-startup-id dunstctl context\n") {
|
||||
t.Fatalf("no key for the context menu: %s", lines)
|
||||
}
|
||||
@@ -100,23 +144,31 @@ func TestTheMenuKeyIsABindingI3Places(t *testing.T) {
|
||||
// predefined font-size (ADR 0348 §2), so a machine with a denser screen sets its own and every other
|
||||
// machine's file is unchanged. Neither is trusted: the file says "trusted": false.
|
||||
func TestTheFontSizeAndWidthAreConfigValuesWithTodaysDefaults(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
want := map[string]float64{"font-size": 10, "width": 250}
|
||||
if len(m.Config) != len(want) {
|
||||
t.Fatalf("config: %+v", m.Config)
|
||||
if len(m.Settings) != len(want) {
|
||||
t.Fatalf("config: %+v", m.Settings)
|
||||
}
|
||||
for key, value := range want {
|
||||
s, ok := m.Config[key]
|
||||
s, ok := m.Settings[key]
|
||||
if !ok || s.Type != "number" || s.Default != value || s.Required || s.Trusted ||
|
||||
strings.TrimSpace(s.Description) == "" || s.Minimum == nil || s.Maximum == nil {
|
||||
t.Errorf("%s: %+v, want an untrusted number defaulting to %v, with a description and bounds", key, s, value)
|
||||
}
|
||||
}
|
||||
if p := m.Config["font-size"].Predefined; p != "font-size" {
|
||||
if p := m.Settings["font-size"].Predefined; p != "font-size" {
|
||||
t.Errorf("the font size falls back to %q, want the predefined font-size", p)
|
||||
}
|
||||
// Filled with the defaults, the file is the one every machine had before it took config values.
|
||||
c := m.text(t, "configuration")
|
||||
c := templateText(t, m, "configuration")
|
||||
c = strings.ReplaceAll(c, "${config:font-size}", "10")
|
||||
c = strings.ReplaceAll(c, "${config:width}", "250")
|
||||
for _, want := range []string{"font = Inter 10", "width = 250"} {
|
||||
@@ -130,7 +182,15 @@ func TestTheFontSizeAndWidthAreConfigValuesWithTodaysDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNothingStartsItButTheBus(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
if m.Shell != nil {
|
||||
t.Fatalf("a session start: %+v", m.Shell)
|
||||
}
|
||||
@@ -147,25 +207,50 @@ func TestNothingStartsItButTheBus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTheToolsAgreeWithTheManifest(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
checkTheToolsAgree(t, m)
|
||||
checkNoSecretsOrInstallationNames(t)
|
||||
}
|
||||
|
||||
// No file resource carries its text inline (novox/hq ADR 0349 §2).
|
||||
func TestEveryFileTakesItsTextFromATemplate(t *testing.T) {
|
||||
readManifest(t).everyFileIsATemplate(t)
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
everyFileIsATemplate(t, m)
|
||||
}
|
||||
|
||||
// dunst moves first (design 57 P6, issue 672): marked moved, its dunstrc is filled on the node by the provisioner's
|
||||
// client from its template, and reloaded as the file declares.
|
||||
func TestItIsHandedToTheProvisioner(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
if !m.Moved {
|
||||
t.Fatal("dunst is not marked moved")
|
||||
}
|
||||
m.fromTemplate(t, "configuration", "files/dunstrc")
|
||||
if on := m.resource(t, "notifier")["reload-on"]; !reflect.DeepEqual(on, []any{"configuration"}) {
|
||||
fromTemplate(t, m, "configuration", "files/dunstrc")
|
||||
if on := resource(t, m, "notifier")["reload-on"]; !reflect.DeepEqual(on, []any{"configuration"}) {
|
||||
t.Fatalf("the notifier is not reloaded on its dunstrc: %v", on)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
||||
)
|
||||
|
||||
// The running dunst reads its file again when the file changes (novox/hq ADR 0262: a setting the
|
||||
@@ -83,8 +85,16 @@ func TestAReloadDunstRefusesIsAFailure(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTheRunningDunstIsReloadedWhenItsFileChanges(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
s := m.resource(t, "notifier")
|
||||
manifestJSON, err := os.ReadFile(filepath.Join("..", "..", "module.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// manifest strictness is the catalog check's (H-A-498): the SDK's reader sets an unknown field aside.
|
||||
m, err := catalogue.Decode(manifestJSON)
|
||||
if err != nil {
|
||||
t.Fatalf("module.json: %v", err)
|
||||
}
|
||||
s := resource(t, m, "notifier")
|
||||
want := map[string]any{
|
||||
"id": "notifier", "type": "service", "unit": "dunst.service",
|
||||
"scope": "user", "user": "${machine:account}",
|
||||
|
||||
Reference in New Issue
Block a user