The delivery repository's contracts and SDK live under modules/ as mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths renamed to match the folders (the TypeScript names already did), and every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools and mesh-sdk follows in the same group: a design as it should be, one path per module, checked by the group's check building every importer. Builds: design 47 G §427, §88 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
68 lines
3.1 KiB
Go
68 lines
3.1 KiB
Go
package build
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds"
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/clients/meshcatalogclient"
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
|
|
)
|
|
|
|
// 1660: at start the builder closes a key left building for a fingerprint the module no longer has.
|
|
func TestAKeyLeftBuildingForAFingerprintTheModuleNoLongerHasIsClosedAtStart(t *testing.T) { // issue 1660
|
|
r := newRig(t, goBundle)
|
|
stale := seed(t, r.st, builds.BuilderBuild{State: builds.BuildBuilding, By: "ace.builder", Manifest: manifestD}) // m at fp1
|
|
other, _ := builds.BuilderBuildKey("gone", fp1)
|
|
data, _ := builds.EncodeBuilderBuild(builds.BuilderBuild{State: builds.BuildBuilding, By: "ace.builder", Manifest: manifestD})
|
|
r.st.put(other, data)
|
|
// The module m has moved on to another fingerprint.
|
|
moved := meshcatalog.ModulesByModuleValue{Repository: "novox/mesh-catalog", Commit: "7a74cee83f88e6585a5511c3cc53bdf0f5303d20", Fp: "src1:" + hex64('f'),
|
|
Fp2: "src2:" + hex64('7'), Manifest: manifestD, Path: "modules/m", Toolchains: CatalogToolchains(agreedToolchains)}
|
|
enc, _ := meshcatalogclient.EncodeModule(moved)
|
|
r.b.Module(context.Background(), "m", enc)
|
|
r.b.Wait()
|
|
if err := r.b.Sweep(context.Background()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, k := range []string{stale, other} {
|
|
v := valueOf(t, r.st, k)
|
|
if v.State != builds.BuildFailed || !strings.Contains(v.Error, "no longer") || !strings.Contains(v.Error, "ace.builder") {
|
|
t.Errorf("%s = %+v, want it closed as failed, naming why and who left it", k, v)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestSweepLeavesAKeyOfTheModulesCurrentFingerprintForTheBuildToTakeOver(t *testing.T) { // issue 1660
|
|
r := newRig(t, goBundle)
|
|
seed(t, r.st, builds.BuilderBuild{State: builds.BuildBuilding, By: "ace.builder", Manifest: manifestD})
|
|
r.b.Module(context.Background(), "m", moduleValue(t, "modules/m")) // takes it over and builds it
|
|
r.b.Wait()
|
|
if err := r.b.Sweep(context.Background()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if v := valueOf(t, r.st, r.key); v.State != builds.BuildDone || v.By != "novox.builder" {
|
|
t.Errorf("build = %+v, want done by novox.builder", v)
|
|
}
|
|
}
|
|
|
|
// A key of a fingerprint a followed half's picture holds is not closed at start, though its entry is not taken in yet: the
|
|
// follower is ready before it tells its entries (design 47 G A-107's restart case: the builder put its asks a second time).
|
|
func TestSweepLeavesAKeyOfAPicturedFingerprintBuildingBeforeItsEntryIsTakenIn(t *testing.T) {
|
|
r := newRig(t, goBundle)
|
|
seed(t, r.st, builds.BuilderBuild{State: builds.BuildBuilding, By: "ace.builder", Manifest: manifestD})
|
|
if err := r.b.Sweep(context.Background(), r.key); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if v := valueOf(t, r.st, r.key); v.State != builds.BuildBuilding {
|
|
t.Errorf("build = %+v, want it left building for the entry to take over", v)
|
|
}
|
|
if err := r.b.Sweep(context.Background()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if v := valueOf(t, r.st, r.key); v.State != builds.BuildFailed {
|
|
t.Errorf("without a picture naming it the key is closed: %+v", v)
|
|
}
|
|
}
|