package buscompose import ( "slices" "testing" ) // A-397: beside each module's durable consumer the tool runner's twin, with the same filters under its own name, and the // events delivered again to one consumer named by the twin itself. func TestTheRunnersTwinBesideTheModulesConsumer(t *testing.T) { c := Consumer{Name: "ace_mod", Stream: "EVENTS", Filters: []string{"mesh.mod.x.event.y", AgainFilter("ace_mod")}} got := withToolsTwin(c) if len(got) != 2 || got[0].Name != "ace_mod" || got[1].Name != "ace_mod_tools" { t.Fatalf("consumers = %+v, want ace_mod and ace_mod_tools", got) } if !slices.Equal(got[1].Filters, []string{"mesh.mod.x.event.y", AgainFilter("ace_mod_tools")}) { t.Errorf("twin filters = %v", got[1].Filters) } if !slices.Equal(got[0].Filters, c.Filters) { t.Errorf("the module's filters changed: %v", got[0].Filters) } }