The controller asks no build of anybody (ADR 0501 §5, ADR 0525 clause 6, ADR 0503 §3). Every module of a walk is taken from the builder's done key; a key not done yet waits, named in the plan, and never fails it. - C2b/C2c: internal/builder and cmd/mesh-controller's asks go (askABuild, onlyTheBuildersOwn, buildOneAsked, takeIn from an outcome, buildAgentsOwn, the builder's say and its fallback, the daemon hearing an outcome). The server follows the retired seats' built subjects only to let go of them, because the installer's carried user list names them. - C2d: replay, queue, cancel, clear, kill, pause, resume, delivery-check, check-here and merge-gate are refused by name. - C3: the check queues (CHECKS_READY, CHECKS_OTHER) and their workers, the checks-running and plans-building buckets and their grants, the build queue and its hold (plans_building.go, queue.go, link/holds.go, builds_nats.go, checks_nats.go). - C4: merge_gate*.go, the pull request's repo-check path, the Checked event and its layers; a pull request asks the controller nothing but to tell mesh-config what its head declares. - C5: the builds bucket is written only by key_takein. - C10 (help and refusals): the terminal's help lists only what is served. Integration tests of the plan's tiers, sends, stops and retries now run on a stand-in builder with a done key for every module (walk_keys_scaffold_integration_test.go); the tests of the asks, the queue, the merge gate and the replays are deleted.
49 lines
1.7 KiB
Go
49 lines
1.7 KiB
Go
//go:build integration
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
"github.com/novox/mesh-controller/internal/inventory"
|
|
)
|
|
|
|
// ADR 0501 §5 (issue 1851): a try is asked of the checker, the head merged onto the trunk, never of build-agent:
|
|
// --store-only is the integration level, --tests passes on, the ask answers the checker's id.
|
|
func TestATryIsAskedOfTheChecker(t *testing.T) {
|
|
open := aMesh(t)
|
|
ctx := t.Context()
|
|
noBuildAsked(t)
|
|
if err := open.inventory.RegisterModule(ctx, catalogue.Manifest{Module: "sudo", Version: "1"},
|
|
inventory.Source{Repository: "novox/mesh-catalog", Seat: "git", Path: "modules/sudo", Ref: "main",
|
|
BuiltFrom: "c0", Head: "c0"}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
wasForge, wasChecker := forgeCommit, askChecker
|
|
forgeCommit = func(context.Context, string, string, string) (string, string, error) {
|
|
return strings.Repeat("c", 40), "main", nil
|
|
}
|
|
var asked []map[string]any
|
|
askChecker = func(_ context.Context, tool string, args map[string]any, into any) error {
|
|
if tool != "checker_try" {
|
|
t.Errorf("asked %s", tool)
|
|
}
|
|
asked = append(asked, args)
|
|
return json.Unmarshal([]byte(`{"id":"try-1"}`), into)
|
|
}
|
|
t.Cleanup(func() { forgeCommit, askChecker = wasForge, wasChecker })
|
|
if err := tryCommand(ctx, []string{"novox/Mesh-Catalog", "fix/x", "--store-only", "--tests", "^TestX$"}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want := map[string]any{"repository": "novox/mesh-catalog", "head": strings.Repeat("c", 40), "trunk": "main",
|
|
"level": "integration", "tests": "^TestX$"}
|
|
if len(asked) != 1 || !reflect.DeepEqual(asked[0], want) {
|
|
t.Fatalf("the checker was asked %v, want %v", asked, want)
|
|
}
|
|
}
|