diff --git a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go index eac7f57..152b03e 100644 --- a/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go +++ b/modules/mesh-delivery-assigner/cmd/mesh-delivery-assigner/integration_test.go @@ -406,6 +406,32 @@ func TestWantsAreWrittenAndNoDifferenceIs(t *testing.T) { if !cleared { t.Errorf("the condition of web on neither list on g14 was not cleared once g14 got its want") } + + // Issue 1126 (ADR 0547 ยง2): the catalogue's placement reaches the indexer's state naming web on every node the + // assignments name it on. Each node then composes its own: its want names the build alone (Self, no composition), and + // its own want says it composes its own, which the node agent reads (mesh-host's TestNats...ComposesAndAppliesItsOwn). + for _, node := range []string{"ace", "g14", "shanks"} { + pl, err := delivery.EncodePlacement(delivery.Placement{Node: node, Modules: []delivery.PlacedModule{{Module: "web"}}}) + if err != nil { + t.Fatal(err) + } + pkey, _ := delivery.PlacementKey(node) + b.putJSON(t, delivery.PlacementBucket, pkey, pl) + } + if w := b.wantNow(t, "ace", "web", "ace's want once placed: the build alone, composed by the node", func(w delivery.Want) bool { return w.Self }); w.Composed != "" || w.FP != fNew { + t.Errorf("ace's want once placed = %+v", w) + } + nkey, _ := delivery.WantNodeKey("ace") + var self bool + for deadline := time.Now().Add(10 * time.Second); time.Now().Before(deadline) && !self; time.Sleep(100 * time.Millisecond) { + if e, err := b.buckets[delivery.AssignerWantsBucket].Get(b.ctx, nkey); err == nil { + nw, err := delivery.DecodeNodeWant(e.Value()) + self = err == nil && nw.Self + } + } + if !self { + t.Error("ace's own want does not say it composes its own once placed") + } } // 1297/B9 (the assigner's half, ADR 0528 clause 6): started whole, the assigner holds a fingerprint whose health check