Plan a controller merge in the worker-of order in the three-kinds test
The test's fixture had no worker-of edge and expected the builder first, then the controller and the proxy together: the order before hq issue 206. Since then the build seat's holder follows the controller that defines its worker, and every controller merge plans controller, builder, proxy in three tiers. The fixture now carries the edge and the test that order.
This commit is contained in:
@@ -259,9 +259,8 @@ func TestASharedRepositoryMovesWhatPackagesItAsItDoesToday(t *testing.T) {
|
|||||||
paths []string
|
paths []string
|
||||||
want string
|
want string
|
||||||
}{
|
}{
|
||||||
// The live three-tier plan of 2026-10-08 (issue 338). It is also the worker-of order (issue 206)
|
// The live three-tier plan of 2026-10-08 (issue 338), in the worker-of order (issue 206) that
|
||||||
// that TestAMergeIsPlannedInTiersAlongTheThreeKindsOfDependency's controller case predates: that
|
// TestAMergeIsPlannedInTiersAlongTheThreeKindsOfDependency's controller case holds too.
|
||||||
// fixture has no worker-of edge and expects the builder first, then the controller and the proxy.
|
|
||||||
{"a README of the controller's repository moves all three, in three tiers", "mesh-controller",
|
{"a README of the controller's repository moves all three, in three tiers", "mesh-controller",
|
||||||
[]string{"README.md"}, "mesh-controller | build-agent | route-proxy"},
|
[]string{"README.md"}, "mesh-controller | build-agent | route-proxy"},
|
||||||
{"the controller's own code: the same", "mesh-controller",
|
{"the controller's own code: the same", "mesh-controller",
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ func TestAMergeIsPlannedInTiersAlongTheThreeKindsOfDependency(t *testing.T) {
|
|||||||
{From: "mesh-controller", To: "builder", Kind: inventory.EdgeBuiltBy},
|
{From: "mesh-controller", To: "builder", Kind: inventory.EdgeBuiltBy},
|
||||||
{From: "mesh-tools", To: "builder", Kind: inventory.EdgeBuiltBy},
|
{From: "mesh-tools", To: "builder", Kind: inventory.EdgeBuiltBy},
|
||||||
{From: "builder", To: "mesh-tools", Kind: inventory.EdgeStandsOn},
|
{From: "builder", To: "mesh-tools", Kind: inventory.EdgeStandsOn},
|
||||||
|
// the build seat's holder follows the controller that defines its worker (hq issue 206)
|
||||||
|
{From: "builder", To: "mesh-controller", Kind: inventory.EdgeWorkerOf},
|
||||||
{From: "unrelated", To: "alpine", Kind: inventory.EdgeStandsOn},
|
{From: "unrelated", To: "alpine", Kind: inventory.EdgeStandsOn},
|
||||||
}
|
}
|
||||||
// The runtime image moved: everything on it, and what is built by what is on it.
|
// The runtime image moved: everything on it, and what is built by what is on it.
|
||||||
@@ -62,12 +64,15 @@ func TestAMergeIsPlannedInTiersAlongTheThreeKindsOfDependency(t *testing.T) {
|
|||||||
if len(small) != 3 {
|
if len(small) != 3 {
|
||||||
t.Fatalf("a controller merge rebuilds the controller and what packages it: %v", small)
|
t.Fatalf("a controller merge rebuilds the controller and what packages it: %v", small)
|
||||||
}
|
}
|
||||||
// The builder packages the controller's source (same tier by that edge) and the controller is
|
// The builder and the proxy package the controller's source, which orders nothing. The builder holds
|
||||||
// built by the builder (next tier by that one): the builder first, then the controller and the
|
// the build seat, whose worker the controller defines, so it follows the controller (worker-of,
|
||||||
// proxy together — a code dependency in one tier, a runtime dependency across tiers.
|
// novox/hq issue 206), and the controller's built-by edge to it yields: the controller is built by the
|
||||||
|
// build machine that is running. The proxy is built by the new builder: the controller, the builder,
|
||||||
|
// the proxy — the live plan of every controller merge. (This read "the builder, then the controller
|
||||||
|
// and the proxy together" before issue 206, and the fixture had no worker-of edge.)
|
||||||
smallTiers := tiersOf(small, edges)
|
smallTiers := tiersOf(small, edges)
|
||||||
if len(smallTiers) != 2 || smallTiers[0][0] != "builder" || len(smallTiers[1]) != 2 {
|
if got := tiered(smallTiers); got != "mesh-controller | builder | route-proxy" {
|
||||||
t.Fatalf("the builder, then the controller and the proxy together: %v", smallTiers)
|
t.Fatalf("the controller, then the builder, then the proxy: %v", smallTiers)
|
||||||
}
|
}
|
||||||
// The builder alone moved: the builder, and nothing it builds.
|
// The builder alone moved: the builder, and nothing it builds.
|
||||||
if only := reachableFrom([]string{"builder"}, edges); len(only) != 1 {
|
if only := reachableFrom([]string{"builder"}, edges); len(only) != 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user