diff --git a/internal/catalogue/seat_data_test.go b/internal/catalogue/seat_data_test.go index 3389ede1..3d2313e9 100644 --- a/internal/catalogue/seat_data_test.go +++ b/internal/catalogue/seat_data_test.go @@ -157,22 +157,39 @@ func TestAPieceTheHolderCannotRenderIsLeftOutAndNamedNotTheMachine(t *testing.T) } } -func TestTheCataloguesBarRendersEveryExampleOfTheShape(t *testing.T) { +// A moved bar is rendered by the provisioner's client, not by the controller, so the rule that its template renders +// every example of the shape is no longer judged here (issue 915, which also covers placementProblems not reading the +// collected form). What the controller still owns is that the bar's files place the blocks at all: a moved bar's +// carry the collected placement, and one that stopped placing them fails here rather than being skipped (issue 432). +func TestTheCataloguesBarPlacesBlocksAndItsShapeCoversEveryShow(t *testing.T) { holder := catalogueManifest(t, "i3status-rust") s, _ := SeatNamed(BarSeat) - if !placesKind(holder, s, BarKindBlock) { - // It places them since the catalogue's bar took the seat; a skip here hid a bar that stopped - // (novox/hq issue 432). - t.Fatal("the catalogue's bar places no blocks, so none of the shape's examples would render") - } - tmpl, err := holderTemplate(holder, s, BarKindBlock) - if err != nil { - t.Fatal(err) - } - for _, ex := range s.Receives[0].Shape.Examples { - out, err := renderPiece(tmpl, "example", "a-machine", ex) - if err != nil || !strings.Contains(out, "[[block]]") { - t.Errorf("the catalogue's bar renders %v as %q: %v", ex, out, err) + if holder.Moved { + placed := "${collected:contribution:" + BarSeat + ":" + BarKindBlock + ":" + found := false + for _, res := range holder.Resources { + if content, _ := res["content"].(string); strings.Contains(content, placed) { + found = true + } + } + if !found { + t.Fatalf("the catalogue's moved bar places no blocks: none of its files carries %s…}", placed) + } + } else { + if !placesKind(holder, s, BarKindBlock) { + // It places them since the catalogue's bar took the seat; a skip here hid a bar that stopped + // (novox/hq issue 432). + t.Fatal("the catalogue's bar places no blocks, so none of the shape's examples would render") + } + tmpl, err := holderTemplate(holder, s, BarKindBlock) + if err != nil { + t.Fatal(err) + } + for _, ex := range s.Receives[0].Shape.Examples { + out, err := renderPiece(tmpl, "example", "a-machine", ex) + if err != nil || !strings.Contains(out, "[[block]]") { + t.Errorf("the catalogue's bar renders %v as %q: %v", ex, out, err) + } } } for shows := range barShows {