The roster publishes a route's internal name, never its public one (hq ADR 0191)
NamesServed read a route's public `name` and plan.go then filtered by suffix — telling the mesh's names from public ones by their spelling, when the mesh composed both itself. It now publishes the `internal-name` it composed under the serving node (ADR 0151); the suffix filter is gone.
This commit is contained in:
@@ -55,14 +55,14 @@ func TestANameResolvesToTheNodeWhoseProxyServesIt(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if served["grafana.home.example"] != "home-server" {
|
||||
if served["grafana.home-server.internal"] != "home-server" {
|
||||
t.Fatalf("run %d: the dashboard's name is served by %q, and its proxy is on the home server: %v",
|
||||
i, served["grafana.home.example"], served)
|
||||
i, served["grafana.home-server.internal"], served)
|
||||
}
|
||||
if served["login.control.example"] != "anchor" {
|
||||
if served["login.anchor.internal"] != "anchor" {
|
||||
t.Fatalf("run %d: the identity provider's own name is served by its proxy on the control node: %v", i, served)
|
||||
}
|
||||
if _, leaked := served["grafana.control.example"]; leaked {
|
||||
if _, leaked := served["grafana.anchor.internal"]; leaked {
|
||||
t.Fatalf("a name composed for the identity provider's benefit is not one it serves: %v", served)
|
||||
}
|
||||
}
|
||||
@@ -91,9 +91,25 @@ func TestEveryRouteOfAModuleWithSeveralIsANameServed(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, name := range []string{"photos.control.example", "photos-api.control.example"} {
|
||||
for _, name := range []string{"photos.anchor.internal", "photos-api.anchor.internal"} {
|
||||
if served[name] != "anchor" {
|
||||
t.Fatalf("%s is not served by its proxy: %v", name, served)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A route's public name is the operator's and answered by public DNS; the mesh publishes only the
|
||||
// internal name it composed for the same route (novox/hq ADR 0191) — told apart by where each was
|
||||
// composed, never by how it is spelled.
|
||||
func TestAPublicNameIsNeverAMeshName(t *testing.T) {
|
||||
plans, settings := twoNodesOneName(t)
|
||||
served, err := NamesServed(plans, settings)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, public := range []string{"grafana.home.example", "login.control.example"} {
|
||||
if node, published := served[public]; published {
|
||||
t.Fatalf("the public name %s is published at %s; public DNS answers it: %v", public, node, served)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user