mesh-sdk joins the sign-in-page milestone only to replace its seatlisttest copies with the three seats' whole definitions, and to update the two tests that assert today's verbs; the seat-name constants and the package's own code stay untouched (ADR 0613 §5: nothing seat-specific is added to mesh-sdk). Builds: design 08 sign-in-page §1, §2, §3, §4
47 lines
1.9 KiB
Go
47 lines
1.9 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// Defends novox/hq ADR 0247: a machine's own resolver is a node seat, held only where something requires
|
|
// `split-dns`; where it is held it writes the resolver file and the uplink's holder steps back from it.
|
|
// Defends design 08 sign-in-page §2 (novox/hq ADR 0687 §2): the seat gains the required verb
|
|
// `uplink-names`, which replaces nothing of a shell command.
|
|
|
|
// The seat: node-scoped, decided by ADR 0247 (gaining ADR 0687 and ADR 0613), and its four verbs required
|
|
// of every holder — a holder exists only once the module serving them does, so nothing has to be optional
|
|
// while it catches up.
|
|
func TestTheMachinesOwnResolverIsANodeSeatWithItsVerbs(t *testing.T) {
|
|
s, ok := SeatNamed(ResolverSeat)
|
|
if !ok {
|
|
t.Fatalf("%s is not in the mesh's set", ResolverSeat)
|
|
}
|
|
if s.Scope != ScopeNode || s.Decision != "novox/hq ADR 0247, ADR 0687, ADR 0613" || s.Delivers != "" || s.Replicated {
|
|
t.Errorf("%s is %+v; a node seat under ADR 0247, ADR 0687, ADR 0613 that delivers nothing", ResolverSeat, s)
|
|
}
|
|
var got []string
|
|
for _, v := range s.Serves {
|
|
got = append(got, v.Name)
|
|
if v.Optional {
|
|
t.Errorf("%s.%s is optional; its first holder serves it", ResolverSeat, v.Name)
|
|
}
|
|
if v.Description == "" || v.Input["type"] != "object" {
|
|
t.Errorf("%s.%s has no description or no object schema", ResolverSeat, v.Name)
|
|
}
|
|
if v.Name != "uplink-names" && len(v.Replaces) == 0 {
|
|
t.Errorf("%s.%s says it replaces nothing", ResolverSeat, v.Name)
|
|
}
|
|
}
|
|
if strings.Join(got, " ") != "routes route unroute uplink-names" {
|
|
t.Errorf("%s serves %v, not routes, route, unroute and uplink-names", ResolverSeat, got)
|
|
}
|
|
// The verbs name a link, domains and servers, and never a VPN: the resolver knows nothing of one.
|
|
for _, v := range s.Serves {
|
|
if strings.Contains(strings.ToLower(v.Description), "forti") {
|
|
t.Errorf("%s.%s names a VPN client: %s", ResolverSeat, v.Name, v.Description)
|
|
}
|
|
}
|
|
}
|