mesh-build-node: hold the member's-build precedence over the registry in a test (H-A-267)
A fetch naming a member's build of a mesh package the registry lacks lays the build and waits on nothing; without the skip in placeMeshPackages it waits for the registry's release. Builds: design 47 H H-A-267
This commit is contained in:
@@ -2,6 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
@@ -124,6 +126,34 @@ func TestAMeshPackageIsNotBeyondTheSdk(t *testing.T) {
|
||||
if v := placedSDK(dir); v != "0.1.15" || r.SDK["modules/m"] != "0.1.15" {
|
||||
t.Errorf("the SDK placed %q, answered %q, want the latest release 0.1.15", v, r.SDK["modules/m"])
|
||||
}
|
||||
|
||||
// A member's build of a mesh package takes precedence: it is laid, and the registry, holding none of it, is not
|
||||
// waited on.
|
||||
const member = "@novox/mesh-tools"
|
||||
m, _ = fetchMachine(t, typeScriptModule(`{"dependencies":{"@novox/mesh-sdk":"^0.1.6","`+member+`":"^0.1.6"}}`), nil)
|
||||
tgz := tgzOf(t, member, "0.0.0-member")
|
||||
digest := digestOf(tgz)
|
||||
store := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/v2/tools/pkg/blobs/"+digest {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
w.Write(tgz)
|
||||
}))
|
||||
defer store.Close()
|
||||
m.ArtifactStoreFile = filepath.Join(t.TempDir(), "artifact-store.json")
|
||||
write(t, m.ArtifactStoreFile, `{"at":"`+strings.TrimPrefix(store.URL, "http://")+`"}`, 0o600)
|
||||
args := map[string]any{"repository": fetchArgs["repository"], "commit": fetchArgs["commit"],
|
||||
"builds": []any{map[string]any{"package": member, "module": "tools", "artifact": "pkg", "digest": digest}}}
|
||||
out, err = m.fetch(context.Background(), args)
|
||||
if err != nil {
|
||||
t.Fatalf("a fetch with a member's build of %s: %v", member, err)
|
||||
}
|
||||
r = out.(FetchResult)
|
||||
got, err = readPackageJSON(filepath.Join(m.Work, r.Workspace, "tree", "modules", "m", "node_modules", filepath.FromSlash(member)))
|
||||
if err != nil || got.Version != "0.0.0-member" {
|
||||
t.Errorf("%s placed %q (%v), want the member's build", member, got.Version, err)
|
||||
}
|
||||
}
|
||||
|
||||
// 1489/AC2: a module naming lodash with a lock gets npm ci --omit=dev --ignore-scripts (fake runner), its install put
|
||||
|
||||
Reference in New Issue
Block a user