package catalogue import ( "testing" ) // Defends novox/hq ADR 0207: a module depends on the node seats that apply its resources. func TestTheSeatsThatApplyResourcesAreTheMeshsOwnAtNodeScope(t *testing.T) { for _, name := range []string{ServiceManagerSeat, PackageManagerSeat, ContainerRuntimeSeat} { s, ok := SeatNamed(name) if !ok { t.Fatalf("%s is not in the mesh's set", name) } if s.Scope != ScopeNode { t.Errorf("%s is held per %s, want per node", name, s.Scope) } } // No verbs yet for either new seat: ADR 0207 seeds the package manager without a protocol, and // the runtime's verbs wait for ADR 0166's acceptance. for _, name := range []string{PackageManagerSeat, ContainerRuntimeSeat} { if s, _ := SeatNamed(name); len(s.Serves)+len(s.Accepts)+len(s.Emits) > 0 { t.Errorf("%s carries a protocol; ADR 0207 seeds it with none", name) } } } // A module-declared seat's needs are judged exactly as a compiled seat's once were (novox/hq ADR // 0220, ADR 0378 ยง8): "mail" declares the node seat "mail-notifier" needing node-notifier, the // mesh's own (desktop notifications); "notifier" claims mail-notifier; "dunst" claims node-notifier, // as it does in the real catalogue. func mailNotifierAndDunst() map[string]Manifest { return shelf( Manifest{Module: "mail", DefinesSeats: []SeatDeclaration{{ Name: "mail-notifier", Scope: ScopeNode, Needs: []string{NotifierSeat}, }}}, mod("notifier", nil, nil, nil, Claim{Name: "mail-notifier"}), mod("dunst", nil, nil, nil, Claim{Name: NotifierSeat}), ) }