Imports rewritten to mesh-sdk's (beside, catalogue, overlay). Left in mesh-controller, which holds their modules: TestTheBuilderRequiresTheRegistryTheNpmSeatDelivers (foundation_manifests_test.go), TestGenesisAssignsTheBuildAgentWithNothingProvidingTheRegistry (genesis_registry_test.go, whole file), TestRouteProxyKeepsItsPublicAccountDirectory (public_issuer_test.go), TestEveryManifestInUseClaimsASeatTheMeshDefines (seats_test.go); with controller_is_a_process_test.go and genesis_image_test.go. moduleTree reads mesh-catalog only: mesh-sdk has no modules directory of its own. beside.Dir lays a repository's captured copy out once per process (a mutex and a map, os.MkdirTemp), new test TestTheCapturedCopyIsLaidOutOnce failed first (two directories). The captured copy is refreshed from the mains: mesh-catalog bb0fe93b, mesh-host cdcba9ca, only what these tests read; CAPTURED says how to move it. Unit level 1.16 s (bound 2 s).
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/internal/beside"
|
|
)
|
|
|
|
// The modules ADR 0226 retired stay retired, and nothing asks for what they provided. A module is
|
|
// in the catalogue when its manifest is: a directory left behind with no manifest in it (a build's
|
|
// leftovers, untracked by git) is not a module, and failed this on a desktop (novox/hq issue 432).
|
|
func TestTheRetiredNetworkingModulesAreNotInTheCatalogue(t *testing.T) {
|
|
modules := beside.Catalogue(t)
|
|
for _, gone := range []string{"public-acme", "dhcpcd", "cloudflare-dns"} {
|
|
if _, err := os.Stat(filepath.Join(modules, gone, "module.json")); err == nil {
|
|
t.Errorf("%s is in the catalogue again; ADR 0226 retired it", gone)
|
|
}
|
|
}
|
|
entries, err := os.ReadDir(modules)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, e := range entries {
|
|
raw, err := os.ReadFile(filepath.Join(modules, e.Name(), "module.json"))
|
|
if err != nil {
|
|
continue
|
|
}
|
|
m, err := ParseManifest(raw)
|
|
if err != nil {
|
|
continue // judged by the catalogue's own tests
|
|
}
|
|
for _, r := range m.Requires {
|
|
if r == "acme-ca" || r == "public-dns" {
|
|
t.Errorf("%s requires %q, which nothing in the catalogue provides since ADR 0226",
|
|
m.Module, r)
|
|
}
|
|
}
|
|
}
|
|
}
|