J26 item 1: build-node tests ask a stand-in registry, never the mesh's
Every TypeScript module of a fetch gets the registry's latest SDK (ADR 0573 §2, A-284), so the harness's machine named the real registry and 11 tests (9 unit, 11 integration runs) reached the network; with the resolver down they failed. The harness now serves a registry of the test's own holding one SDK release, and the userconfig test reads its address from it. Builds: design 47 G A-284, A-285 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -207,9 +207,7 @@ func TestAnotherNovoxPackageIsInstalledFromTheRegistryThroughAUserconfig(t *test
|
||||
files := typeScriptModule(`{"dependencies":{"@novox/other":"^1","lodash":"^4"}}`)
|
||||
files["modules/m/package-lock.json"] = `{}`
|
||||
m, f := fetchMachine(t, files, map[string]string{"@novox/other/index.js": "o", "lodash/index.js": "l"})
|
||||
m.Toolchain.Registry = func() (Registry, error) {
|
||||
return Registry{URL: "https://git.novox.be/api/packages/novox/npm/"}, nil
|
||||
}
|
||||
reg, _ := m.Toolchain.Registry()
|
||||
var npmrc string
|
||||
inner := f.effect
|
||||
f.effect = func(c call) {
|
||||
@@ -226,7 +224,7 @@ func TestAnotherNovoxPackageIsInstalledFromTheRegistryThroughAUserconfig(t *test
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Reads are anonymous (ADR 0346, CAT-BN3): the config names the scope's registry and no credential.
|
||||
if !strings.Contains(npmrc, "@novox:registry=https://git.novox.be/api/packages/novox/npm/") || strings.Contains(npmrc, "_auth") {
|
||||
if !strings.Contains(npmrc, "@novox:registry="+reg.URL+"\n") || strings.Contains(npmrc, "_auth") {
|
||||
t.Errorf("npm ci was given the config %q", npmrc)
|
||||
}
|
||||
r := out.(FetchResult)
|
||||
|
||||
@@ -73,10 +73,11 @@ func newMachine(t *testing.T) (*Module, *fakeMachine, string) {
|
||||
home, cache, work := t.TempDir(), t.TempDir(), t.TempDir()
|
||||
f := &fakeMachine{now: time.Unix(1_000_000, 0), cost: map[string]time.Duration{}, answer: map[string]forgekey.Ran{}}
|
||||
m := &Module{Node: "ace", Recipe: Recipe{Steps: "1", Lock: "lock"},
|
||||
Toolchain: &Toolchain{Paths: Paths{Home: home, Cache: cache}, Registry: func() (Registry, error) {
|
||||
return Registry{URL: "https://git.novox.be/api/packages/novox/npm/"}, nil
|
||||
}},
|
||||
Work: work, Clock: f.clock, Ctx: context.Background()}
|
||||
Toolchain: &Toolchain{Paths: Paths{Home: home, Cache: cache}},
|
||||
Work: work, Clock: f.clock, Ctx: context.Background()}
|
||||
// A test never reaches the network: the registry is a stand-in of the test's own, holding one release of the SDK
|
||||
// (every TypeScript module of a fetch gets the latest, ADR 0573 §2); a test that needs another calls fakeRegistry.
|
||||
fakeRegistry(t, m, map[string][]byte{"0.1.15": tgzOf(t, sdkPackage, "0.1.15")})
|
||||
// A run step's commands run in bubblewrap (1309); the fake reads each back and runs its command.
|
||||
m.Run = throughBubblewrap(t, f.run, &f.shut)
|
||||
withStore(t, m) // a build pushes its bundle to a store of the test's own (ADR 0498)
|
||||
|
||||
Reference in New Issue
Block a user