Round 2 T2, T5: mesh-wireguard and route-proxy end G with their merge-base test counts; roles in the test
mesh/delivery merged: source.main moved to novox/mesh-networking@9be2faaf8b00
mesh/delivery-group group feat/47-G-join12 merged: every member is merged
mesh/check checking ccfdaec5ed2d on 9be2faaf8b00 | novox/mesh-networking#6 in group feat/47-G-join12

The two tests G added fold into existing ones as subtests (design 47 G §626); route-proxy's provider test names
a role, not a node (T5).

Builds: design 47 G §626, A-306; review round 2 findings T2, T5
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 22:20:32 +01:00
parent 7ebd665c76
commit ccfdaec5ed
3 changed files with 47 additions and 49 deletions
+26 -27
View File
@@ -73,34 +73,33 @@ func TestEveryProvisionTheModuleOffersSaysItsCredentialForm(t *testing.T) {
t.Errorf("%s offers credential %+v: the form is none", o.Name, o.Credential) t.Errorf("%s offers credential %+v: the form is none", o.Name, o.Credential)
} }
} }
} // Design 47 G §411, §339, §341: no artifact of this repository's manifests keeps a `series` (one version per module), and
// the generated TypeScript contract is `index.js` with its `index.d.ts`, with no source for a build of its own.
// Design 47 G §411, §339, §341: no artifact of this repository's manifests keeps a `series` (one version per module), and t.Run("NoArtifactKeepsASeriesAndTheTypeScriptContractIsJavaScript", func(t *testing.T) {
// the generated TypeScript contract is `index.js` with its `index.d.ts`, with no source for a build of its own. for _, path := range []string{"../../module.json", "../../../mesh-connectivity-contracts/module.json"} {
func TestNoArtifactKeepsASeriesAndTheTypeScriptContractIsJavaScript(t *testing.T) { file, err := os.ReadFile(path)
for _, path := range []string{"../../module.json", "../../../mesh-connectivity-contracts/module.json"} { if err != nil {
file, err := os.ReadFile(path) t.Fatal(err)
if err != nil { }
t.Fatal(err) var m struct {
} Build struct {
var m struct { Artifacts []map[string]any `json:"artifacts"`
Build struct { } `json:"build"`
Artifacts []map[string]any `json:"artifacts"` }
} `json:"build"` if err := json.Unmarshal(file, &m); err != nil {
} t.Fatal(err)
if err := json.Unmarshal(file, &m); err != nil { }
t.Fatal(err) for _, a := range m.Build.Artifacts {
} if _, ok := a["series"]; ok {
for _, a := range m.Build.Artifacts { t.Errorf("%s: the artifact %v keeps a series, which the manifest validator refuses (§411)", path, a["name"])
if _, ok := a["series"]; ok { }
t.Errorf("%s: the artifact %v keeps a series, which the manifest validator refuses (§411)", path, a["name"])
} }
} }
} dir := "../../../mesh-connectivity-contracts/ts/seats/theprivatenetwork/"
dir := "../../../mesh-connectivity-contracts/ts/seats/theprivatenetwork/" for file, want := range map[string]bool{"index.js": true, "index.d.ts": true, "src/index.ts": false, "tsconfig.json": false} {
for file, want := range map[string]bool{"index.js": true, "index.d.ts": true, "src/index.ts": false, "tsconfig.json": false} { if _, err := os.Stat(dir + file); (err == nil) != want {
if _, err := os.Stat(dir + file); (err == nil) != want { t.Errorf("%s: present %v, want %v (§341)", file, err == nil, want)
t.Errorf("%s: present %v, want %v (§341)", file, err == nil, want) }
} }
} })
} }
@@ -57,8 +57,8 @@ func TestAConsumerOfARouteIsToldItsNamesFromItsPlanEntry(t *testing.T) {
"grafana": {"name": "grafana.example.org"}, "grafana": {"name": "grafana.example.org"},
} { } {
plan, err := meshprovisionerclient.EncodePlan(meshprovisionerclient.Plan{Node: "g14", Module: module, Plan: catalogue.Plan{ plan, err := meshprovisionerclient.EncodePlan(meshprovisionerclient.Plan{Node: "g14", Module: module, Plan: catalogue.Plan{
Provisions: []catalogue.PlanProvision{{Provision: ProvisionName, Provider: "novox", ProviderModule: ModuleName, Provisions: []catalogue.PlanProvision{{Provision: ProvisionName, Provider: "anchor", ProviderModule: ModuleName,
At: "10.7.0.1", From: "novox", As: "mesh_g14_" + module, Names: names}}}}) At: "10.7.0.1", From: "anchor", As: "mesh_g14_" + module, Names: names}}}})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -67,7 +67,7 @@ func TestAConsumerOfARouteIsToldItsNamesFromItsPlanEntry(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
asked, err := json.Marshal(meshprovisionerclient.Provision{V: meshprovisionerclient.Version, Provision: ProvisionName, asked, err := json.Marshal(meshprovisionerclient.Provision{V: meshprovisionerclient.Version, Provision: ProvisionName,
Consumer: meshprovisionerclient.End{Node: "g14", Module: module}, Provider: meshprovisionerclient.End{Node: "novox", Module: ModuleName}, Consumer: meshprovisionerclient.End{Node: "g14", Module: module}, Provider: meshprovisionerclient.End{Node: "anchor", Module: ModuleName},
State: meshprovisionerclient.Asked}) State: meshprovisionerclient.Asked})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@@ -76,7 +76,7 @@ func TestAConsumerOfARouteIsToldItsNamesFromItsPlanEntry(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
} }
p := newProvider("novox", theProvisioner, bus, t.Logf) p := newProvider("anchor", theProvisioner, bus, t.Logf)
out, err := p.Pass(context.Background()) out, err := p.Pass(context.Background())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@@ -30,24 +30,23 @@ func TestTheReadIsTheManifests(t *testing.T) {
if !slices.Contains(m.Invokes, "seat:mesh-module-assigner.assignments") { if !slices.Contains(m.Invokes, "seat:mesh-module-assigner.assignments") {
t.Errorf("the proxy asks who holds a seat, its manifest invokes %v", m.Invokes) t.Errorf("the proxy asks who holds a seat, its manifest invokes %v", m.Invokes)
} }
} // A read in the seat form is the bus's `<holder>.<state>` of the holder on record, whoever it is.
t.Run("HolderReadResolvesTheSeat", func(t *testing.T) {
// A read in the seat form is the bus's `<holder>.<state>` of the holder on record, whoever it is. call := func(holder string) func(string, any) (json.RawMessage, error) {
func TestHolderReadResolvesTheSeat(t *testing.T) { return func(string, any) (json.RawMessage, error) {
call := func(holder string) func(string, any) (json.RawMessage, error) { return json.RawMessage(`{"seats":[{"seat":"mesh-provisioner","holders":[{"module":"` + holder + `"}]}]}`), nil
return func(string, any) (json.RawMessage, error) { }
return json.RawMessage(`{"seats":[{"seat":"mesh-provisioner","holders":[{"module":"` + holder + `"}]}]}`), nil
} }
} for _, holder := range []string{"one", "another"} {
for _, holder := range []string{"one", "another"} { if got, err := holderRead(call(holder), plansRead); err != nil || got != holder+".plans" {
if got, err := holderRead(call(holder), plansRead); err != nil || got != holder+".plans" { t.Errorf("holderRead = %q, %v; want %s.plans", got, err, holder)
t.Errorf("holderRead = %q, %v; want %s.plans", got, err, holder) }
} }
} if _, err := holderRead(func(string, any) (json.RawMessage, error) { return nil, errors.New("down") }, plansRead); err == nil {
if _, err := holderRead(func(string, any) (json.RawMessage, error) { return nil, errors.New("down") }, plansRead); err == nil { t.Errorf("a failed ask was taken as a holder")
t.Errorf("a failed ask was taken as a holder") }
} if _, err := holderRead(call("x"), "mesh-provisioner.plans"); err == nil {
if _, err := holderRead(call("x"), "mesh-provisioner.plans"); err == nil { t.Errorf("a read naming a module was taken as a seat's")
t.Errorf("a read naming a module was taken as a seat's") }
} })
} }