test: repair fixtures and inventories for the pool gate
Provide explicit pool evidence and matching route lifetimes in fixtures, wait for withdrawal stops during cleanup, and inventory the routing-only record read and changed name producers.
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
10 files changed,
+56
−27
internal/activator/haduties_test.go+1 −1internal/activator/poolwithdrawal_test.go+7 −0internal/activator/probewake_test.go+2 −2internal/console/lifetimes_audit_test.go+1 −0internal/host/assetpublish_test.go+1 −1internal/host/group_names_test.go+27 −13internal/host/group_pool_test.go+8 −1internal/host/startupsweep_test.go+3 −3internal/sim/regionha/actions_test.go+1 −1internal/sim/regionha/witness_test.go+5 −5
CI failed — run details
diff --git a/internal/activator/haduties_test.go b/internal/activator/haduties_test.go| index 626730bc7..1079023fa 100644 |
| --- a/internal/activator/haduties_test.go |
| +++ b/internal/activator/haduties_test.go |
| @@ -133,7 +133,7 @@ func TestHADutyNeverWokenPool(t *testing.T) { |
| if ref == "a" { |
| hosts[s.rt.Host] = map[string]any{"role": "home", "account": release.RouteAccount(s.rt), "app": s.rt.App} |
| } |
| - body, _ := json.Marshal(map[string]any{"v": 1, "box": ref, "box_id": "i-" + ref, "eip": "203.0.113.10", "region": "eu-west-1", "placement": "hapair", "data_bucket": "data", "secrets_key_fp": "fp", "generation": time.Now().UTC().Format(time.RFC3339Nano), "capabilities": []string{boxchoice.Capability}, "hibernation_configured": true, "hosts": hosts}) |
| + body, _ := json.Marshal(map[string]any{"v": 1, "box": ref, "box_id": "i-" + ref, "eip": "203.0.113.10", "region": "eu-west-1", "placement": "hapair", "data_bucket": "data", "secrets_key_fp": "fp", "generation": time.Now().UTC().Format(time.RFC3339Nano), "capabilities": []string{boxchoice.Capability}, "hibernation_configured": true, "served_pools": []string{""}, "hosts": hosts}) |
| if _, err := store.Put(context.Background(), "control/edges/"+ref+".json", body, ""); err != nil { |
| t.Fatal(err) |
| } |
diff --git a/internal/activator/poolwithdrawal_test.go b/internal/activator/poolwithdrawal_test.go| index dfe34e5cf..7826edf05 100644 |
| --- a/internal/activator/poolwithdrawal_test.go |
| +++ b/internal/activator/poolwithdrawal_test.go |
| @@ -65,6 +65,13 @@ func TestPoolWithdrawalRequiresCompleteProof(t *testing.T) { |
| for _, mode := range []string{"awake", "asleep", "populated", "failed-sync", "failed-publication", "owed", "duties", "record-read", "changed-lifetime", "changed-pool", "restart", "restart-dirty", "successor"} { |
| t.Run(mode, func(t *testing.T) { |
| s, e := haServiceEntry(t, "shop.example.com") |
| + if mode != "restart-dirty" { |
| + original := s |
| + t.Cleanup(func() { |
| + original.unit.set(func(u *haUnit) { u.sliceHeld = false; u.slicePop = false }) |
| + original.stopForTest(e) |
| + }) |
| + } |
| facts, err := s.b.Cfg.Record(context.Background(), s.rt) |
| if err != nil { |
| t.Fatal(err) |
diff --git a/internal/activator/probewake_test.go b/internal/activator/probewake_test.go| index ac3c85bf2..54d02170f 100644 |
| --- a/internal/activator/probewake_test.go |
| +++ b/internal/activator/probewake_test.go |
| @@ -310,11 +310,11 @@ func TestRetireExceptKeepsTheHeldProbeEntry(t *testing.T) { |
| t.Parallel() |
| a, _, _, reg := testActivator(t, time.Hour) |
| a.Routes = reg |
| - held := registry.Route{Host: "one.example.com", Kind: "instance", Socket: "/tmp/nope.sock", DBPath: "/tmp/one.example.com.db", Hibernate: true} |
| + held := testRoute("one.example.com") |
| if err := reg.Upsert(held); err != nil { |
| t.Fatal(err) |
| } |
| - release, err := a.beginRequest(context.Background(), testRoute("one.example.com")) |
| + release, err := a.beginRequest(context.Background(), held) |
| if err != nil { |
| t.Fatal(err) |
| } |
diff --git a/internal/console/lifetimes_audit_test.go b/internal/console/lifetimes_audit_test.go| index e6769accb..8a55473f6 100644 |
| --- a/internal/console/lifetimes_audit_test.go |
| +++ b/internal/console/lifetimes_audit_test.go |
| @@ -102,6 +102,7 @@ func TestNoUnjudgedRecordReads(t *testing.T) { |
| // unjudgedReadPermitted is the pinned allowlist: the only functions, by |
| // resolved symbol, in which a forbidden read may appear, each with why. |
| var unjudgedReadPermitted = map[string]string{ |
| + "(*github.com/carlosframework/platform/internal/provision.ViewSnapshot).HAIngressRoutes": "routing-only snapshot: retains retired names as refusals; projects host, owner, pool and lifetime without a local path or provisioning authority; the receiver must match its own admitted route before serving", |
| // The judged readers themselves: under a nil judge each delegates to its |
| // unjudged sibling, which is the claims-on behaviour. |
| "github.com/carlosframework/platform/internal/provision.ReadRecordJudged": "judged reader; a nil judge is GetRecordETag", |
diff --git a/internal/host/assetpublish_test.go b/internal/host/assetpublish_test.go| index 3107788e1..659f8e42a 100644 |
| --- a/internal/host/assetpublish_test.go |
| +++ b/internal/host/assetpublish_test.go |
| @@ -669,7 +669,7 @@ func TestPublishesNothingUnderAnExclusion(t *testing.T) { |
| // Not acceptance: the clocks are fed reports directly (the authority table |
| // runs the real passes); the writer and the reader are the production ones. |
| func TestPooledRouteCatchesLocallyOnly(t *testing.T) { |
| - t.Parallel() |
| + t.Setenv("CARLOS_POOLS", "team") |
| w := newAssetWorld(t) |
| w.ship("v1", "/assets/") |
| w.instance("shop.example.com", assetGen1, "v1", func(r *registry.Route) { r.Pool = "team" }) |
diff --git a/internal/host/group_names_test.go b/internal/host/group_names_test.go| index 587067f3d..0cdecc6c8 100644 |
| --- a/internal/host/group_names_test.go |
| +++ b/internal/host/group_names_test.go |
| @@ -363,23 +363,37 @@ func unrelated() { println("before") } |
| // preserves held source names as refusal-only entries. Existing exact-route |
| // and alias cases remain the name classes; claim gate witnesses live alongside |
| // the seed and moved implementations. |
| +// Pool-gate changes keep the existing name classes: |
| +// - HAIngressRoutesFromRecords projects exact instance hosts for forwarding only. |
| +// - Reconcile passes those exact names before the pool filter, retaining stale |
| +// names as refusals; pool withdrawal removes local rows after stop and release. |
| +// - ReconcileSidecars withdraws synthetic sidecar names by the same proof. |
| +// - ReconcileAliasesReport retains regional exact and catchall claim names and |
| +// their region-selected target; it creates no locally runnable route. |
| +// - Reload blocks ingress for held, unready, import-gated and sidecar names. |
| +// - foldRegional preserves the regional claim and marks exact-route conflicts. |
| +// - edgesFileWriteClaims omits local hosts outside the configured pool; it |
| +// does not publish forwarding-only ingress as home. |
| +// |
| +// Existing ingress and regional tests cover routing and refusal of these names. |
| var groupNameProducerInventory = map[string]string{ |
| - "../provision/demo_claim_seed.go:abortDemoClaimSeed": "e010b4e6b026a0744b7eacf6ffdb09647de6e1541e33ce73e71e7c99964a9f7a", |
| - "../domains/aliases.go:ReconcileAliasesReport": "c022beb479d23f0be5f0cb1c591daf9f479507bb7acd2fb9262c1392357c0c61", |
| - "../domains/aliases.go:deriveInstanceAliases": "47b40b392927d9c50cab6c350083af24565e4e148cd1b5ddc257e9803153c0c2", |
| - "../domains/aliases.go:deriveRegional": "79fd7c432e6b0a9ffd945312851e52af2c450769416ef44ff9a4bea681b44cde", |
| - "../domains/reconcile.go:Reconcile": "8b2848535d0a15117d578ac28c7486997c6ad8960b58b6dca5d4b35cde14eed0", |
| - "../domains/reconcile.go:mintedRoute": "dbd2211f62fc606661c6d8258ecfbf18f0b3c865e775522c5b363d01c442fca9", |
| - "../edge/assetcatch.go:*Edge.AssetOwners": "2b9ce5620a6defa16f12cb38d389ac59aa594049d37d84746f0a76419ab05b5f", |
| - "../edge/assetcatch.go:*Edge.serveAssetFar": "7d358ec272ae74c05764504550bad461096a09d0bfcc108dcbe5485f8f68d643", |
| + "../provision/haingress.go:HAIngressRoutesFromRecords": "522ceaf7e1f57dabe02b0d6cfbd939ba73ec8826cb804506867e5120a346968e", |
| + "../provision/demo_claim_seed.go:abortDemoClaimSeed": "e010b4e6b026a0744b7eacf6ffdb09647de6e1541e33ce73e71e7c99964a9f7a", |
| + "../domains/aliases.go:ReconcileAliasesReport": "4dc373672420c2d6b533bb4b5d1e442d1b0423b8af24db1cd48b89b1388ec5d2", |
| + "../domains/aliases.go:deriveInstanceAliases": "47b40b392927d9c50cab6c350083af24565e4e148cd1b5ddc257e9803153c0c2", |
| + "../domains/aliases.go:deriveRegional": "79fd7c432e6b0a9ffd945312851e52af2c450769416ef44ff9a4bea681b44cde", |
| + "../domains/reconcile.go:Reconcile": "8b2848535d0a15117d578ac28c7486997c6ad8960b58b6dca5d4b35cde14eed0", |
| + "../domains/reconcile.go:mintedRoute": "dbd2211f62fc606661c6d8258ecfbf18f0b3c865e775522c5b363d01c442fca9", |
| + "../edge/assetcatch.go:*Edge.AssetOwners": "2b9ce5620a6defa16f12cb38d389ac59aa594049d37d84746f0a76419ab05b5f", |
| + "../edge/assetcatch.go:*Edge.serveAssetFar": "7d358ec272ae74c05764504550bad461096a09d0bfcc108dcbe5485f8f68d643", |
| // Demo protections wrap existing proxies and retain refusal-only names. |
| // They do not derive or publish a new group-name class. The site demo API |
| // proxy is built over an existing exact console row and publishes no name. |
| - "../edge/edge.go:*Edge.Reload": "ab3ad32da2ce50fe852366c42a07496c0748cfb93daa1c7ad68708e73fdfcbbd", |
| + "../edge/edge.go:*Edge.Reload": "9df3a40130a4c26edc728e67e4cec2788ea8be1fe28eb495013bfeba1154f3e0", |
| "../edge/platformalias.go:PlatformAliasFold": "a18e4963cf88320ef3fb94b666b02838dc12cc3e9b2df3f2cbe2576ca682735f", |
| - "../edge/regional.go:*Edge.foldRegional": "b413fad6a8e17530ce0e99c79c521e0a6782b82c04d61d256442b8defe6a427b", |
| + "../edge/regional.go:*Edge.foldRegional": "2c52d0d9147ab4b426649a78573a8550e0ba1073e2f5e5ef10e894f2570e9a8d", |
| "../provision/forward.go:forwardRowFor": "e7294d6a3c96e51646257200f5cedb26aaf491afea23be3d943b3e3f742c4db4", |
| - "../provision/reconcile.go:Reconcile": "cda911d2c5634ea58aafa86e9469a0412ebe70a87588d045b73d67d55f347042", |
| + "../provision/reconcile.go:Reconcile": "f50138e764b8b8b9af30751a51e187a2a667a1bf2a3ba75cd0b30252bbd6c62e", |
| "../provision/reconcile.go:RouteFor": "304e92d9123c1cc7d756319756c4311ee235266cd6b2290f058c91e45fbe0cc1", |
| "../provision/reconcile.go:mintHeld": "9fe4ad876c727af36cc06bd0105baf344748c61e6f21ced48e5288a323851344", |
| "../provision/seedreconcile.go:purgeAbortedFromLocal": "889e93e6fbd74adf614ba184bcd2f554196eccc4506829c65326a3502e98d89a", |
| @@ -387,13 +401,13 @@ var groupNameProducerInventory = map[string]string{ |
| // B6 retains the synthetic sidecar name and Kind. HA affects lifetime and |
| // nested DB paths only; TestSidecarNeverAdvertisedOrDialled exercises the |
| // real stamped record/reconcile/publication path as well as the legacy row. |
| - "../provision/sidecar_reconcile.go:ReconcileSidecars": "36b82e9b7ce96372c51f8b88c57a3118ad2da0f1ea0999a9449c29d91023f196", |
| + "../provision/sidecar_reconcile.go:ReconcileSidecars": "d656cff0e545d332ddb8282e464896f949f05cadaa29533c1ae58e556c998f21", |
| "../provision/sidecar_reconcile.go:sidecarRouteFor": "c8cc26bdb7a0aff550219b1c095fd0289392620465b659cd29e5ef4e7895028a", |
| "claimretire_transport.go:ClaimRootHTTP.retire": "a60c74d0e0461e0a432f9a338aa25799cc0cd9d163c7b6eb803cfb33d55d7c2a", |
| "claimunit_binding.go:claimUnitShape.route": "f38fd6e10aba680354ee908c255fd34e731fe2d1a22fffd41ac449e8b763dd2c", |
| "claimunit_policy.go:claimUnitShapeCheck": "45f16830e5ed834995ca573a710f1e390a504b7eb78c3c0465ac70e7f306e50c", |
| "claimunit_policy.go:rootClaimRestartShape": "1d0370516c32482b1784f4bd4ab0deb042c31120d81f4dc8c417f52b24ef76ac", |
| - "edgesfile.go:edgesFileWriteClaims": "d0908b18fdd13657a74a6ef814d39d0ce6fe3f770da102bda335363b64080cb4", |
| + "edgesfile.go:edgesFileWriteClaims": "db2cee40a66e82362acf832cf4dddef95cf29451cdc3b1b6f1910b392540e95e", |
| "movesheldenv.go:composeHeldEnv": "17ad3714758d1c07a71375734c125496855a16ca800eb814bde58283d3a5318b", |
| "movesheldrelease_root.go:heldReleaseRoute": "10bf824edc963319a38a47b91877b865977b1dc4a27c6e7680c46704289a7df7", |
| "movesstage.go:heldReleasePublished": "edad51c04a01657b77a9fc469404db5fde51cff1f2c61e243d6a717fb6224e85", |
diff --git a/internal/host/group_pool_test.go b/internal/host/group_pool_test.go| index 1fd006d28..ba88b6990 100644 |
| --- a/internal/host/group_pool_test.go |
| +++ b/internal/host/group_pool_test.go |
| @@ -43,6 +43,13 @@ func TestGroupPoolIsolation(t *testing.T) { |
| for _, peer := range peers { |
| reg := edgesTestRegistry(t) |
| t.Run(peer.name, func(t *testing.T) { |
| + configured := append([]string(nil), peer.pools...) |
| + for i, pool := range configured { |
| + if pool == "" { |
| + configured[i] = "@shared" |
| + } |
| + } |
| + t.Setenv("CARLOS_POOLS", strings.Join(configured, ",")) |
| regs[peer.name] = reg |
| if err := provision.Reconcile(t.Context(), store, reg, provision.ReconcileConfig{Region: "ie", Pools: peer.pools, DataDir: t.TempDir()}); err != nil { |
| t.Fatal(err) |
| @@ -63,7 +70,7 @@ func TestGroupPoolIsolation(t *testing.T) { |
| var last []byte |
| yes, no := true, false |
| - ident := edgesFile{Box: peer.name, Region: "eu-west-1", Placement: "ie", DataBucket: "data", SecretsKeyFP: "shared", HibernationConfigured: true, Capabilities: []string{capRegionHA1}, BoxRole: "serve", Admitted: &yes, Drained: &no, Headroom: &edgeHeadroom{MemFreeMiB: 300, MemTotalMiB: 1000, DiskFreeMiB: 300, DiskTotalMiB: 1000}} |
| + ident := edgesFile{ServedPools: (provision.ReconcileConfig{Pools: peer.pools}).ServedPools(), Box: peer.name, Region: "eu-west-1", Placement: "ie", DataBucket: "data", SecretsKeyFP: "shared", HibernationConfigured: true, Capabilities: []string{capRegionHA1}, BoxRole: "serve", Admitted: &yes, Drained: &no, Headroom: &edgeHeadroom{MemFreeMiB: 300, MemTotalMiB: 1000, DiskFreeMiB: 300, DiskTotalMiB: 1000}} |
| if err := edgesFileWrite(t.Context(), store, reg, ident, "127.0.0.1", &last, true); err != nil { |
| t.Fatal(err) |
| } |
diff --git a/internal/host/startupsweep_test.go b/internal/host/startupsweep_test.go| index 0493e9b44..18a7f4e23 100644 |
| --- a/internal/host/startupsweep_test.go |
| +++ b/internal/host/startupsweep_test.go |
| @@ -92,8 +92,8 @@ func TestStartupSweepMarksOnlyWhenClean(t *testing.T) { |
| // Arming the overlap scheduler opens the rootfs admission's armed half |
| // (ArmRootfs) and a refused arming does not: an unarmed box's refusal is |
| -// the member's RFS-3-C12 event with RFS-3-C14, an armed box's refusal for |
| -// another reason (here, no exec backend) is the operator's log alone. |
| +// the member's RFS-3-C12 event with RFS-3-C14, an armed box's refusal at |
| +// a later rootfs gate is the operator's log alone. |
| func TestArmingOpensRootfsAdmission(t *testing.T) { |
| _, pub, err := release.GenerateKey() |
| if err != nil { |
| @@ -113,7 +113,7 @@ func TestArmingOpensRootfsAdmission(t *testing.T) { |
| "unavailable": {func(context.Context) (release.Store, error) { return nil, errors.New("no deployment store") }, false}, |
| } { |
| t.Run(name, func(t *testing.T) { |
| - svc, reg, dd := rolloutFixture(t, true) |
| + svc, reg, dd := rolloutFixtureWith(t, true, &activator.SplitBackend{Exec: &activator.ExecBackend{ServedPools: testSharedPoolEvidence}}) |
| svc.GenerationsFile = release.GenerationsPath(dd) |
| sink := &armSink{} |
| svc.Logs = sink |
diff --git a/internal/sim/regionha/actions_test.go b/internal/sim/regionha/actions_test.go| index 06ca64aa5..c294f0dab 100644 |
| --- a/internal/sim/regionha/actions_test.go |
| +++ b/internal/sim/regionha/actions_test.go |
| @@ -1249,7 +1249,7 @@ func (w *world) requestPlacedAt(b *box, h string, hopped bool, depth int) { |
| observation = nil |
| delete(p.Observations, h) |
| } |
| - d := activator.DecidePlacement(placedRoute(h), b.Self, observation, s, peers, w.now()) |
| + d := activator.DecidePlacement(placedRoute(h), b.Self, observation, s, true, peers, w.now()) |
| // Caller regressions: incorrectly require placement capability or folded |
| // membership before honoring the production rule's local/Base answer. |
| if !on("placement-ignores-switch") && !s.Enabled && d.Kind == activator.Base { |
diff --git a/internal/sim/regionha/witness_test.go b/internal/sim/regionha/witness_test.go| index 79dc96165..741d17d32 100644 |
| --- a/internal/sim/regionha/witness_test.go |
| +++ b/internal/sim/regionha/witness_test.go |
| @@ -785,13 +785,13 @@ func TestPlacementPublicOrdering(t *testing.T) { |
| s := w.coldSnapshot(A, sh) |
| v := hafresh.View{Absent: true} |
| s.Running[B.Self.Ref] = boxchoice.Load{Apps: map[string]int{"bab/shop": 1}} |
| - d := activator.DecidePlacement(rt, A.Self, &v, s, activator.PlacementPeerView{}, w.now()) |
| + d := activator.DecidePlacement(rt, A.Self, &v, s, true, activator.PlacementPeerView{}, w.now()) |
| if d.Ref != A.Self.Ref { |
| t.Fatal("app spread must precede free memory", d) |
| } |
| s.Running = nil |
| s.Serving[0].MemFreeMiB = 149 |
| - d = activator.DecidePlacement(rt, A.Self, &v, s, activator.PlacementPeerView{}, w.now()) |
| + d = activator.DecidePlacement(rt, A.Self, &v, s, true, activator.PlacementPeerView{}, w.now()) |
| if d.Ref != B.Self.Ref { |
| t.Fatal("ineligible memory candidate chosen", d) |
| } |
| @@ -803,7 +803,7 @@ func TestPlacementPublicBoundaries(t *testing.T) { |
| s := w.coldSnapshot(A, sh) |
| v := hafresh.View{Absent: true} |
| decide := func(s boxchoice.WakeSnapshot) activator.PlacementDecision { |
| - return activator.DecidePlacement(placedRoute(sh), A.Self, &v, s, activator.PlacementPeerView{}, w.now()) |
| + return activator.DecidePlacement(placedRoute(sh), A.Self, &v, s, true, activator.PlacementPeerView{}, w.now()) |
| } |
| for _, boundary := range []struct { |
| age time.Duration |
| @@ -962,8 +962,8 @@ func TestPlacementCompetingFoldCAS(t *testing.T) { |
| own.Free = 900 |
| A.Placement.Fold[A.Self.Ref] = own |
| av, bv := w.view(sh), w.view(sh) |
| - da := activator.DecidePlacement(placedRoute(sh), A.Self, &av, w.coldSnapshot(A, sh), activator.PlacementPeerView{}, w.now()) |
| - db := activator.DecidePlacement(placedRoute(sh), B.Self, &bv, w.coldSnapshot(B, sh), activator.PlacementPeerView{}, w.now()) |
| + da := activator.DecidePlacement(placedRoute(sh), A.Self, &av, w.coldSnapshot(A, sh), true, activator.PlacementPeerView{}, w.now()) |
| + db := activator.DecidePlacement(placedRoute(sh), B.Self, &bv, w.coldSnapshot(B, sh), true, activator.PlacementPeerView{}, w.now()) |
| if da.Ref != A.Self.Ref || db.Ref != B.Self.Ref { |
| t.Fatal("setup needs divergent preferences", da, db) |
| } |