Files
mesh-delivery/modules/mesh-delivery-sdk/manifest_test.go
T
jschoubben 3e61b70517 SD5, BG11, BLD10: the build modules' shared code moves into the delivery SDK
All of mesh-build-go's buildstep Go module leaves mesh-catalog for
modules/mesh-delivery-sdk: the step run, fetch and release and the
regenerate-and-compare step as the package steprun, the CPU share as
steprun/buildcpu, the conformance kit as steprun/conformance, the seat
generator as seatgen with cmd/seatgen, and cmd/mesh-pack. The three
build modules and the builder's and checker's tests import the SDK and
keep no copy; the SDK requires nothing of mesh-catalog. Code the build
modules share is the delivery domain's SDK, not one module's package.
It carries the build-module round's two new files of that package
(dropdetected.go 247c422f, storedbuilds.go 904b8aed).

Builds: design 47 G §464, §680, §327, §420, §495

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 05:18:34 +01:00

59 lines
1.9 KiB
Go

package sdk
import (
"encoding/json"
"os"
"strings"
"testing"
)
// The module's one package artifact is the module's whole directory, which it says by leaving `paths` out: the manifest
// validator refuses the word "." as a path (a package artifact naming one directory).
func TestThePackageArtifactNamesNoPathForTheWholeDirectory(t *testing.T) {
raw, err := os.ReadFile("module.json")
if err != nil {
t.Fatal(err)
}
var m struct {
Build struct {
Artifacts []struct {
Name string `json:"name"`
Paths []string `json:"paths"`
} `json:"artifacts"`
} `json:"build"`
}
if err := json.Unmarshal(raw, &m); err != nil {
t.Fatal(err)
}
if len(m.Build.Artifacts) != 1 {
t.Fatalf("artifacts are %+v: one", m.Build.Artifacts)
}
for _, a := range m.Build.Artifacts {
for _, p := range a.Paths {
if p == "." || p == "" {
t.Errorf("artifact %s names %q as a path: leave `paths` out for the module's whole directory", a.Name, p)
}
}
}
}
// The build modules' shared code is this SDK's (design 47 G §464, §680): the step runner `steprun` with its per-node CPU
// share and its conformance kit, the seat generator `seatgen` and the commands `seatgen` and `mesh-pack`; and the SDK
// requires nothing of mesh-catalog, whose build modules import it.
func TestTheSDKHoldsTheBuildModulesSharedCodeAndRequiresNoCatalogModule(t *testing.T) {
for _, dir := range []string{"steprun", "steprun/buildcpu", "steprun/conformance", "seatgen", "cmd/seatgen", "cmd/mesh-pack"} {
if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {
t.Errorf("%s is not a package of the delivery SDK: %v", dir, err)
}
}
raw, err := os.ReadFile("go.mod")
if err != nil {
t.Fatal(err)
}
for _, line := range strings.Split(string(raw), "\n") {
if strings.Contains(line, "git.novox.be/novox/mesh-catalog/") {
t.Errorf("go.mod names a mesh-catalog module: %s", strings.TrimSpace(line))
}
}
}