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) } } } }