package main import ( "strings" "testing" "git.novox.be/novox/mesh-sdk/go/catalogue" ) // Defends novox/hq ADR 0207 at the controller's acts: `assign` refuses a module whose resources a // seat nothing on the node holds applies, `unassign` refuses taking the last holder from under its // dependents, and `status` reports what composition does not yet refuse. func serviceManagerHolder() catalogue.Manifest { return catalogue.Manifest{Module: "systemd", Version: "1", Claims: []catalogue.Claim{{Name: catalogue.ServiceManagerSeat, Scope: catalogue.ScopeNode, Serves: []string{"units", "status", "start", "stop", "restart", "enable", "disable", "journal", "reset-failed", "wanted-by", "unlink-dangling"}}}, Resources: []map[string]any{{"id": "systemd", "type": "package", "package": "systemd"}}} } func packageManagerHolder() catalogue.Manifest { return catalogue.Manifest{Module: "pacman", Version: "1", Claims: []catalogue.Claim{{Name: catalogue.PackageManagerSeat, Scope: catalogue.ScopeNode}}, Resources: []map[string]any{{"id": "refresh", "type": "service", "unit": "pacman-refresh.timer"}}} } func aDaemon() catalogue.Manifest { return catalogue.Manifest{Module: "sshd", Version: "1", Resources: []map[string]any{{"id": "sshd", "type": "service", "unit": "sshd.service"}}} } func TestTheControllerSeatsAssignTakesSeveralModulesAsOneAct(t *testing.T) { argv, err := argvFor("assign", map[string]any{"node": "laptop", "module": "systemd, pacman"}) if err != nil { t.Fatal(err) } if strings.Join(argv, " ") != "assign laptop systemd pacman" { t.Errorf("the seat's assign became %v", argv) } }