package cli import ( "testing" "gitea.mynodes.xyz/ilker/llmgw/internal/control" "gitea.mynodes.xyz/ilker/llmgw/internal/control/agentsvc" "gitea.mynodes.xyz/ilker/llmgw/internal/control/fabrictest" ) func TestTheForwardingDispatcherCarriesEveryCapability(t *testing.T) { // dispatcherRef exists to break a construction cycle, and it satisfies the // dispatcher interface by forwarding each method by hand. That makes it a // place where capabilities go missing silently: the controller reaches // past the interface by type assertion, and an assertion against this type // fails for anything nobody remembered to forward. // // It happened. `ctl weights --collect` returned "this control plane cannot // ask nodes to delete files" against a real cluster, while every unit test // passed — because the test dispatchers do not implement the capability // either, so its absence looked exactly like the expected case. var ref any = &dispatcherRef{} if _, ok := ref.(control.WeightRemover); !ok { t.Error("dispatcherRef drops WeightRemover, so the control plane cannot reclaim disk") } if _, ok := ref.(fabrictest.Asker); !ok { t.Error("dispatcherRef drops the bandwidth test, so ctl fabric-test cannot reach the agents") } // And the thing it forwards to must have it, or the forwarding has nothing // to reach. var svc any = &agentsvc.Service{} if _, ok := svc.(control.WeightRemover); !ok { t.Error("the agent service does not implement WeightRemover") } if _, ok := svc.(fabrictest.Asker); !ok { t.Error("the agent service does not implement the bandwidth test") } }